Ext.define('MyApp.view.MyVehicleGridPanel', {
extend: 'Ext.grid.Panel',
alias: 'widget.mygrid',
header: false,
store: UserStore,
multiSelect: false,
columns: [
{
xtype: 'gridcolumn',
dataIndex: '_id',
text: 'Vehicle ID'
},
{
xtype: 'gridcolumn',
width: 126,
dataIndex: 'Plat_No',
text: 'Plat Number'
},
{
xtype: 'gridcolumn',
width: 200,
dataIndex: 'Name',
text: 'Added By'
}
]
})
i dont have any id declare in the gridpanel, because it will used in dynamicly,
so, i m using alias to find my grid component like below code
var grid = Ext.ComponentQuery.query('mygrid');
console.log( Ext.ComponentQuery.query('mygrid') );
if (grid.getSelectionModel().hasSelection()) { //error at here
var row = grid.getSelectionModel().getSelection()[0];
console.log(row.get('Plat_No'));
};
But, firebug return error with TypeError: grid.getSelectionModel is not a function
any other way to find my gridpanel component?
Ext js - Components - ExtJS UI is made up of one or many widgets called Components. Ext Js has various UI components defined that can be customized as per your requirements.
Depending on your ExtJS version you may see other attributes, such as an ARIA role. When we discard the fluff we're left with something very simple: Let's add a few more options and some CSS so that we can actually see the component. The three settings we've added translate pretty directly into the markup for our component's element:
setHeader updates the contents of the header. It is written in such a way that it could be called before or after the component is rendered. Even if you never have to write a low-level component like this, understanding the techniques it uses should help you to get a better grasp on the ExtJS source code.
First let's tackle some common misconceptions. If you've spent a lot of time working with other frameworks then you might fall into the trap of viewing an ExtJS component as little more than an abstraction for manipulating a DOM element. In other words, the DOM is king.
Ext.ComponentQuery.query()
returns an array of matched Components from within the passed root object.
So if you have only one mygrid
component in your application, you can get your grid like this:
var grid = Ext.ComponentQuery.query('mygrid')[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With