Access a value in selected row -outside of grid

QuestionsAccess a value in selected row -outside of grid
John Godish asked 12 years ago

I need to access a value from the selected row in a grid with php code on the same page but outside of the grid itself. Is this possiable?

3 Answers
Abu Ghufran answered 12 years ago

Here is sample code …

<button onclick='get_date()'>Get Selected Date</a>
<script>
function get_date(){

var selr = jQuery('#list1').jqGrid('getGridParam','selrow'); // returns null if no row is selected (single row)
// var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow'); // array of id's of the selected rows when multiselect options is true. Empty array if not selection

var rd = jQuery('#list1').jqGrid('getCell', selr, 'invdate'); // where invdate is column name
alert(rd);
}
</script>

George answered 11 years ago

when i use "var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow');"
and select 2 rows and more the jquery shows false.How can i fetch the value of all selected checkboxes in the sellarrow array?

Abu Ghufran answered 11 years ago

It works in this way. Most likely you are calling this function before complete loading of grid.
It is best to call this code onclick event of some button … or loadcomplete event of grid.

Your Answer

8 + 1 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?