PDA

View Full Version : how to check grid rows



rameshr
29 Oct 2009, 9:33 PM
HI im using checkbox selection in grid in ext-gwt. i want to check some rows in grid on loading?

huangxingchina
29 Oct 2009, 10:09 PM
first you must prepare the store for grid:

store = new Ext.data.JsonStore({
id : 'gridStore',
root : 'items',
totalProperty : 'count',
fields : ["id", "xmbh", "name"],
url : 'vocherTypeAction!findItems.action',
listeners : {
load : function() {
if (fetchData.usedItemIds != null) {
var usedItemIds = new String(fetchData.usedItemIds);
var usedItemIds = usedItemIds.split(",");
for (var i = 0; i < store.getCount(); i++) {
for (var j = 0; j < usedItemIds.length - 1; j++) {
if (usedItemIds[j] == store.getAt(i).data.id) {
sm.selectRow(i,true);
}
}
}
}
}
}
});

fetchData.usedItemIds is you wants checked ids

second new the grid :

grid = new Ext.grid.EditorGridPanel({
name : "grid",
id : "grid",
width : 885,
height : 560,
sm : sm,
border : false,
stripeRows : true,
cm : colm,
store : store,
bbar : bbar,
bodyStyle : 'border-right-width:0px;border-left-width:0px;border-buttom-width:0px;',
clicksToEdit : 1
});

Animal
29 Oct 2009, 10:18 PM
Not going to work.

You have to use the new GridPanel viewready event in the latest release.

rameshr
29 Oct 2009, 10:38 PM
thanks for replays but i want in ext-gwt

huangxingchina
29 Oct 2009, 10:46 PM
our project just used this method .


viewready event why i can't find this in the latest release

3.0 or ?

sven
30 Oct 2009, 1:32 AM
When using GXT 2.0.2 you can simple select them. The grid will display them correctly. Prior to that you have to select them after the gridview has rendered.