How we can restrict my grid to select only specific row for example my grid ID which starts with F should be selected and the grid ID which starts from I should not be selected.
My sample code that I used to create a grid is as follows:
mygrid.addRow(‘I390’,[‘I’,‘390’,‘TestI1’,’’,’’,‘imgs/feeds.gif’,‘B22’,], mygrid.getRowIndex(mygrid.getSelectedId()),‘B22’ ,’…/imgs/feeds.gif’);
mygrid.addRow(‘F6818’,[‘F’, ‘6818’.‘TestF1’,’’,’’, ‘imgs/feeds.gif’,‘I390’,], mygrid.getRowIndex(mygrid.getSelectedId()),‘I390’,’…/imgs/fc.jpg’);
mygrid.addRow(‘F6819’,[‘F’, ‘6819’.‘TestF2’,’’,’’, ‘imgs/feeds.gif’,‘I390’,], mygrid.getRowIndex(mygrid.getSelectedId()),‘I390’,’…/imgs/fc.jpg’);
Please provide some sample for this.
Thanks in advance, Vikrant
mygrid.attachEvent(“onBeforeSelect”,function(id){
if (id.toString().charAt(0)==“I”) return false;
return true;
});
if we have selected only one row which ID is whatever started with ‘I’ or ‘F’. I have to select that row and in case I have selected more than one row i have to select only those Rows which ID starts with “F”. Please help me its very urgent.
Thanks,Vikrant
in case of multi-selection enabled
mygrid.attachEvent(“onBeforeSelect”,function(id){
if (id.toString().charAt(0)==“F”) return false; //allow any kind of selection for “F” like rows
return (mygrid.getSelectedId().split(",")<2); //alows only single selection for other kinds of row
});
The code you provided me gives an error when I select any row. The error message shows mygrid.getSelectedId() is null or not an object. None of the rows get selected. Please help.