-
9 Jul 2012 8:15 PM #1
Getting value of gridpanel's cell
Getting value of gridpanel's cell
Hi guys.
I have a gridpanel with some columns. Also i have CheckboxSelectionModel. And i want to get value of cell with name "id" of checked rows.
ColumnsCode:var sm = new Ext.grid.CheckboxSelectionModel({ //header: '', //singleSelect : 'true', listeners: { selectionchange: function(sm) { //alert('coucou : ' + sm.getSelected().id); alert('coucou : ' + sm.selectRow(0)); } } });
How to do this??Code:var cm = new Ext.grid.ColumnModel({ columns: [sm,{ xtype: 'checkcolumn', header: '', dataIndex: 'indoor', width: 50 },{ header: 'id', dataIndex: 'kad_id', width: 70 },{ header: 'Участок', dataIndex: 'kad_name', width: 130, }] })
-
9 Jul 2012 8:24 PM #2
Ok im dummy. To get a value of cell with name id needed
Code:var sm = new Ext.grid.CheckboxSelectionModel({ listeners: { selectionchange: function(sm) { alert('coucou : ' + sm.getSelected().get("id")); } } });
-
9 Jul 2012 8:52 PM #3
But how to get multiple select?
Not work.Code:for(h=0;h<sm.getSelections().length;h++){ alert(sm.getSelections[h].get("kad_id")); }
-
9 Jul 2012 9:52 PM #4
And i want to get value of cell with name "id" of checked rows.
Hi!
you may use following for multiple selections.
above, nameCellValues (which is an array) contains your selected row's id cell values.Code:var selectedRecords=yourGrid.getSelectionModel().getSelection(), nameCellValues=[]; for(var i=0;i<selectedRecords.length;i++){ nameCellValues.push(selectedRecords[i].get('kad_id')); }sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
10 Jul 2012 12:48 AM #5
Strange but this code work.
Code:var getS=csm.getSelections(); for(var hh=1;hh<csm.getSelections().length;hh++){ //do something }


Reply With Quote