How do I make the new row take the focus?

QuestionsHow do I make the new row take the focus?
Javier asked 3 years ago

Hello, I need to know how to make a new row that is added to the end of the grid, take the focus, that is, be the “selected” one? I am not using pagination and $grid[“scroll”] = true.

Once I add the row (in mysql), I update the grid with:

jQuery(‘#lstGrid’).trigger(‘reloadGrid’,[{jqgrid_page:1}]);

but the following code does not work:

setTimeout(function(){

$(“#lstGrid”).jqGrid(‘setSelection’, new_row_id );

}, 500);

Thanks for the help!

1 Answers
Abu answered 3 years ago

Apparently, It seems like the new_row_id is not in the displayed listing to be selected.

One option is to sort the grid descending with row_id so the new row will be shown first and after that selection should work as expected.

I think It will work without setSelection as well in above solution.

Your Answer

16 + 4 =

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?