-
4 Oct 2012 6:48 AM #1
Answered: Ext.selection.CheckboxModel help needed
Answered: Ext.selection.CheckboxModel help needed
I want to get the 1st column value when i select a row. below code is returning me undefined.
need inputs.Code:var sm = Ext.create('Ext.selection.CheckboxModel',{ listeners: { select: function(this1, record, index, eOpts ){ alert(record.get(index)); } } });
-
Best Answer Posted by skirtleShould be:Code:
alert(record.get(company));
Code:alert(record.get('company'));
-
4 Oct 2012 6:52 AM #2
The get method of a record returns field values based on their name, not an index. e.g.:
So just pass it the field name, i.e. the dataIndex, of your first column.Code:record.get('age')
-
4 Oct 2012 6:59 AM #3
its throwing exception: company not defined
Code://////////////////////////////////////////////////////////////////////////////////////// // Grid 2 //////////////////////////////////////////////////////////////////////////////////////// var sm = Ext.create('Ext.selection.CheckboxModel',{ listeners: { select: function(this1, record, index, eOpts ){ alert(record.get(company)); } } }); var grid2 = Ext.create('Ext.grid.Panel', { store: getLocalStore(), selModel: sm, columns: [ {text: "Company", width: 200, dataIndex: 'company'}, {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'}, {text: "Change", dataIndex: 'change'}, {text: "% Change", dataIndex: 'pctChange'}, {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} ], columnLines: true, width: 600, height: 300, frame: true, title: 'Framed with Checkbox Selection and Horizontal Scrolling', iconCls: 'icon-grid', renderTo: Ext.getBody() });
-
4 Oct 2012 7:03 AM #4
Try this :
or (this is the same)PHP Code:alert(this.getSelectionModel().getSelection()[0].data.company);
PHP Code:alert(this.getSelectionModel().getSelection()[0].get('company'));
-
4 Oct 2012 7:04 AM #5
Should be:Code:alert(record.get(company));
Code:alert(record.get('company'));


Reply With Quote