Select first row in master on load

QuestionsSelect first row in master on load
bazel asked 9 years ago

1. How can I select first row in master table when loading page so I can see detail records.
2. How can values in select/dropdown column from other table (get_dropdown_values function) be refreshed with grid reload? New values are not showing if I reload the grid. I must refresh the whole page and then they appear

Thanks

2 Answers
Abu Ghufran answered 9 years ago

1) Following config will select the first row of grid on load event. You can customize as per your need.

PHP:
$e["js_on_load_complete"] = "grid_onload";
$grid->set_events($e);

JS:
function grid_onload(ids)
{
// get row ids from grid (with id: list1)
var ids = $("#list1").jqGrid('getDataIDs');
setTimeout( function(){ jQuery('#list1').jqGrid('setSelection', ids[0], true); },100);
}

Also check: https://phpgrid.desk.com/customer/portal/questions/2196686-select-row-on-load-page

2) To refersh dropdown each time it's displayed you need to set onload-sql param,
Emailing you a demo code and updated lib.

bazel answered 9 years ago

Thanks. Both answers worked perfectly. Great support

Your Answer

10 + 18 =

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?