Reputation: 13539
I have a Grid..
And I have a toolbar..
Ext.define('js.grid.PackageGrid', {
extend: 'Ext.grid.Panel',
tbar: [{
GridUtils.getSearchTextField(myGridReferenceHere)
}]
}
I need to get a reference to the defining Grid. I am not sure this is possible. Is it possible?
EDIT FROM ORIGINAL POSTER:
I ended up doing it like this: The text field is defined in the grid, and only the search action is delegated to another method.
tbar: [{
xtype: 'textfield', enableKeyEvents: true, listeners: {
keyup: function (string) {
var grid = this.up();
gridUtils.getSearchAction(tablestore, string, grid)
}
}
}]
Upvotes: 0
Views: 1134
Reputation: 5856
It is not possible during the define time. You execute the above method at the time when neither grid nor toolbar exists. You can get the reference during initComponent
execution of either grid or toolbar but not at the define time.
For more info see:
Upvotes: 1
Reputation: 395
Try this:
tbar: [{
GridUtils.getSearchTextField(this.up())
}]
http://docs-devel.sencha.com/extjs/4.2.1/#!/api/Ext.toolbar.Toolbar-method-up
Upvotes: 0