I was under the impression that using '*' in require will allow you to import all classes in that package.
This does not work :
Ext.define('EM.app.myController', {
extend: 'Ext.app.Controller',
requires: [
'EM.app.controlUnit.searchModule.*'
],
However this does work :
Ext.define('EM.app.myController', {
extend: 'Ext.app.Controller',
requires: [
'EM.app.controlUnit.searchModule.SearchPanel'
],
This does not work as expected.
I am using SearchPanel as an xtype and a very obscure error is thrown pertaining to some substring on undefined on some rewrite objects in some parseNamespace method (that's a whole other story... 5 hours down the drain trying to figure that one out)
Is this maybe because I am using an old version of Extjs (4.1) ?
Related
The remoteSort option does not seem to work in terms of respecting the network call returned data order. The frontend will override whatever the order is and resort based on how it "should" be sorted.
Is this a bug, or is there something else that should be implemented that I don't know about when using remoteSort on a treepanel?
Here is a snippet of the remote sort code:
Ext.define('MyApp.stores.MyStore', {
extend: 'Ext.data.TreeStore',
alias: 'store.myStore',
storeId: 'myStoreID',
remoteSort: true,
remoteFilter: true,
simpleSortMode: true,
sortOnLoad: false,
autoLoad: true,
pageSize: 20,
proxy: {
type: 'ajax',
filterParam: 'query',
url: 'myEndpoint',
reader: {
type: 'json',
...
The treepanel loads correctly (no errors), the remote call IS MADE. When selecting a column to sort by it DOES send the correct data to the backend. The data DOES return. It even displays fine. But the ORDER IS WRONG.
The order is being sorted by the FE, rather than using the order of array elements returned by the backend.
The ONLY thing I have found so far is disabling the sort from the front end entirely when the grid is rendered using the afterrender property, but this disables the ability to send ASC and DESC, and the sort gets stuck in the ASC mode. This also does not seem like the correct way to make this work for obvious reasons.
The Sencha docs do not offer enough guidance around this for me to debug it properly
I am trying to get my site setup with Gatsby + MDX. I am looking at the documentation here and want to make use of the autolink-header-option. I have tried using the rehype and remark plugins for this, but I can only get the Rehype plugin to work and only with the wrap option. I would much prefer the GitHub (default) style with the link coming before the title.
I am using the below config in gatsby-config.js and cleared .cache and public after updating the file to be sure nothing was cached. Also I am not getting any errors, everything builds and runs successfully, there just is not any link to the headers.
{
resolve: `gatsby-plugin-mdx`,
options: {
rehypePlugins: [
// To pass options, use a 2-element array with the
// configuration in an object in the second element
require("rehype-autolink-headings"),
],
},
},
UPDATE
After trying multiple configurations, the way I was able to get it working as expected was with a different plugin config.
{
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [ `gatsby-remark-autolink-headers` ],
plugins: [ `gatsby-remark-autolink-headers` ],
},
}
Both gatsbyRemarkPlugins and plugins are required as per: https://github.com/gatsbyjs/gatsby/issues/15486
The README for rehype-autolink-headings mentions that:
This package works with headings that have IDs. One way to add IDs to headings is by using remark-slug before this plugin.
Changing your config to the following should fix it:
{
resolve: `gatsby-plugin-mdx`,
options: {
rehypePlugins: [
require("rehype-slug"),
// To pass options, use a 2-element array with the
// configuration in an object in the second element
require("rehype-autolink-headings"),
],
},
},
In fact, the documentation you linked to has this additional require line as well, but it doesn't clarify what it is used for.
I am creating a ExtJS 6 package to reuse a library across my extjs app. I need to extend Ext.field.TextArea functionality. could someone have a simple example to start with?
Like this:
Ext.define('MyPackage.form.field.MyTextArea', {
extend: 'Ext.form.field.TextArea',
xtype: 'my-textarea'
});
And in your package.json verify you've got the following values:
"type": "code",
"toolkit": "classic",
A grid has editable rows, connected to a store which has a proxy.
It uses the api e.g.
proxy: {
type: 'ajax',
api: {
create: 'dm/acct/new.php',
read: 'dm/acct/read.php',
update: 'dm/acct/update.php',
destroy: 'dm/acct/rm.php'
},
extraParams: {
sess: 2345
},
If I add extraParms to the store's proxy e.g. {abc:123} as shown above, when I come to edit a field on a grid, that detail is accompanied by the record at the server with the value defined. I can inspect it in the read.php.
However, for testing, I tried replacing abc with an application level var, e.g.
{abc:RPA.app.A_GLOBAL_VAR}
results in
Uncaught TypeError: Cannot read property 'A_GLOBAL_VAR' of undefined - this surprised me since the var is declared at the Application level and I thought would be scoped and available. This error causes the application to fail to run at all.
I have got it working but I don't like my approach because I think it is using the wrong event and I have not been able to spot a more suitable one.
On the grid' cell dblClick event I have:
var sto = Ext.getCmp('acc_grid').getStore();
var proxy= sto.getProxy();
proxy.setExtraParam('abc', somevar );
I definitely get the value of abc:somvar server-side - so does what I want. I just think it is bad design/wrong event and wondered if there is a better way of attaching the extra param to the record when the update on an editable grid? I have looked at other examples but not stumbled across one that I have been able to relate to.
Many thanks
Kevin
Listen to the CellEditor plugin edit event rather than the cell dblclick...
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.plugin.CellEditing
When you set your cell editing plugin...
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners:{
edit:function(){ doSomething }
}
})
],
When I create a model using Ext.create() in ExtJs 4.2+, I am expecting the mapping to fill the model but it does not seem to do it. Is it a normal behavior?
If I use a model with mapping in a store, the mapping works fine...
Example not working:
http://jsfiddle.net/B6v6v/
Ext.define('MyApp.model.file', {
extend: 'Ext.data.Model',
fields: [
{
name: 'name',
mapping:'label'
}]
});
var rec = Ext.create("MyApp.model.file",{"label":"TEST"});
console.log(rec.get("name"));
Yes, it's normal. The mapping is for transforming data coming in from the server into something readable in your model. If you already have the data, why not just use the correct key?
If you must, you can do something like:
MyApp.model.File.getProxy().getReader().readRecords([{}, {}, {}]);