Set row as selected before load

QuestionsSet row as selected before load
Francisco Javier Jiménez asked 10 years ago

Hi,
I need set some rows as selected when datagrid is load, How can I do it?

Thank you

1 Answers
Abu Ghufran answered 10 years ago

In php, you can connect onload event. (refer demo/editing/custom-event)

$e["js_on_load_complete"] = "do_onload";
$grid->set_events($e);

Then can use following JS code to select rows.

<script>
function do_onload(id)
{
var ids = jQuery('#list1').jqGrid('getDataIDs'); // this is array of all ids.

jQuery('list1').jqGrid('setSelection',5); // here 5,6,7 are rows ids (first col value)
jQuery('list1').jqGrid('setSelection',6);
jQuery('list1').jqGrid('setSelection',7);
}
</script>

Your Answer

7 + 16 =

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?