PDA

View Full Version : overrriding Ext.ux.LiveSearchGridPanel



jgrocha
10 Apr 2015, 2:11 AM
Hi,

I'm trying to override Ext.ux.LiveSearchGridPanel using a MVC pattern, using Exts 4.2.1.883 and Cmd v4.0.4.84.

I've created a new folder app/overrides/ux/.
I've created a new LiveSearchGridPanel.js under app/overrides/ux/LiveSearchGridPanel.js with:


Ext.define('Ext.overrides.ux.LiveSearchGridPanel',{
override:'Ext.ux.LiveSearchGridPanel',
initComponent: function () {
var me = this;
me.tbar = ['Procurar', {
xtype: 'textfield',
name: 'searchField',
hideLabel: true,
width: 200,
listeners: {
change: {
fn: me.onTextFieldChange,
scope: this,
buffer: 100
}
}
}];
me.callParent(arguments);
}
});


I also edited sencha.cfg to include:


app.classpath=${app.dir}/app,${app.dir}/app.js,${app.dir}/resources/js,${app.dir}/geoext2-2.0.2/src,${app.dir}/overrides
app.overrides=${app.dir}/overrides

In the view where I use LiveSearchGridPanel, I've added:


requires: ['Ext.overrides.ux.LiveSearchGridPanel'],


The sencha app build runs fine, and adds the following to bootstrap.js:


Ext.Loader.addClassPathMappings({
"Ext": "ext/src",
"Ext.overrides": "app/overrides",
(...)
});


In bootstrap.js there is no:


Ext.Loader.loadScript("app/overrides/ux/LiveSearchGridPanel.js");;


The refresh/build works, but the class Ext.ux.LiveSearchGridPanel is not being overrided in my views.

What is missing here to make it work?

tristan.lee
17 Apr 2015, 1:24 PM
Hi,

Cmd has an overrides folder in your app root that's created when you generate an application. You should place your overrides there rather than in app/overrides/.

Hope that helps,
Tristan