0

Its like I have multiselect option in Jqgrid in which i want to pass the selected rows value to the server and based on the value i will delete the rows. I dont want to have the ids to do my work. For the Single row i get the cell value and delete using the same. But for multi select its not the case. In getGridParam('selarrrow'); I use this to fetch the selected rows bu the values are not getting populated. Please help me out in doing the same

When i use the following code as i saw in some sample question i can fetch the value for the single row selection but when i select multiple rows then i pass it says like "FALSE" or "UNDEFINED". What can be the issue. var grid = jQuery('#list'); var sel_id = grid.jqGrid('getGridParam', 'selarrrow'); var myCellData = grid.jqGrid('getCell', sel_id, 'CountryId');

skaffman
  • 398,947
  • 96
  • 818
  • 769
hkv
  • 163
  • 1
  • 6
  • 15
  • When i use the following code as i saw in some sample question i can fetch the value for the single row selection but when i select multiple rows then i pass it says like "FALSE" or "UNDEFINED". What can be the issue. var grid = jQuery('#list'); var sel_id = grid.jqGrid('getGridParam', 'selarrrow'); var myCellData = grid.jqGrid('getCell', sel_id, 'CountryId'); – hkv Nov 23 '10 at 11:38
  • 1
    You can any time **modify** (better **append**) the text of your question. It is better as to write a comment to the question with additional information. – Oleg Nov 24 '10 at 09:49

1 Answers1

1

I got this done by using the for loop for getting the selected rows id i did some thing like this and I am able to fetch the value. Thought this might help others too please check it

var myrow;
var id = jQuery("#List").jqGrid('getGridParam','selarrrow');
if(id.length)
{
    for (var i=0;i<id.length;i++)  // For Multiple Delete of row
        {
            myrow = jQuery("#List").jqGrid('getCell',id[i],'ticker'); 
        }
}
Oleg
  • 220,925
  • 34
  • 403
  • 798
hkv
  • 163
  • 1
  • 6
  • 15
  • 1
    With such for loop you overwrite the previous value of `myrow`. After the end of the loop you will have in the `myrow` the value corresponds to the **last** selected row. You don't describe in your question in which form you want have the values. Probably `var myrow=[];` and later ` myrow.push(jQuery("#List").jqGrid('getCell',id[i],'ticker');` is what you want? – Oleg Nov 24 '10 at 09:56
  • Yes Exactly this is what im really very sorry i missed out that any ways thanks dude. – hkv Nov 24 '10 at 10:01
  • I have more small doubt can you please check the following URL http://stackoverflow.com/questions/4265039/multiselect-issue-in-jqgrid – hkv Nov 24 '10 at 10:04
  • 1
    I read you question which are deleted now, but not really understand what you want to archive. Some piece of code like `$('#cb_list').checked=true;` should be fixed to `$('#cb_list').attr("checked",true);`. But probably your problem is already solved. Another old answers http://stackoverflow.com/questions/3587480/jquery-modal-dialog-and-jqgrid/3588732#3588732 and http://stackoverflow.com/questions/3717969/jqgrid-multiselect-behavior-when-pressing-special-key/3719637#3719637 could be probably helpful for you. – Oleg Nov 24 '10 at 14:39