tags:

views:

685

answers:

1

Is there a way for the JQGrid to return an array of column Data for using multiSelect as opposed to just an array of rowIds ?

At the moment I can only return the last column data that was selected.

jQuery("#buttonSelected").click(function() {

           var ids = jQuery("#relatedSearchGrid").getGridParam('selarrrow');
           var count = ids.length;

           for (var i = 0; i < count; i++) {

           var columnData = $("#relatedSearchGrid").find("tbody")[0].rows[$("#relatedSearchGrid").getGridParam('selrow') - 1].cells[1].innerHTML;

               alert("In the loop and  " + columnData );

           }

           if (count == 0) return;
           var posturl = '<%= ResolveUrl("~") %>Rel******/AddSelected****/' + ids;
           if (confirm("Add these " + count + " Docs?")) {
               $.post(posturl,
               { ids: columnData },
               function() { jQuery("#relatedSearchGrid").trigger("reloadGrid") },
            "json");
           }


       })
+1  A: 

Use getRowData to get the data for each row:

var rowData = $("#relatedSearchGrid").getRowData(ids[i]);

var colData = rowData.Name_Of_Your_Column;
Justin Ethier
Thanks Justin for the speedy, concise and correct solution.You are a gentleman and a scholar.
Spanner