Categories | Question details Back To List | ||||||||
restrict to select a row 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 Answer posted by Support on Nov 11, 2008 05:07 mygrid.attachEvent("onBeforeSelect",function(id){ if (id.toString().charAt(0)=="I") return false; return true; }); Answer posted by Vikrant on Nov 11, 2008 21:26 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
Answer posted by Support on Nov 12, 2008 04:20 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 }); Answer posted by vikrant on Nov 12, 2008 21:12 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. Answer posted by Support on Nov 13, 2008 06:05 Working sample attached to email. Attachments (1)
|