Help me! setSelection don't work

QuestionsHelp me! setSelection don't work

Hi. After insert a register on my table mysql, I want select that, but don’t work. My code is:

$(‘#lstAlumnos’).trigger(‘reloadGrid’, [{current:true}]);

setTimeout(function(){

$(“#lstAlumnos”).jqGrid(‘setSelection’, dni );

$(“#lstAlumnos”).jqGrid(‘getGridParam’, ‘selrow’).focus();

}, 500);

 

The line :

$(“#lstAlumnos”).jqGrid(‘getGridParam’, ‘selrow’).focus();

Show error in the console, its says: Encaught TypeError: $(…).jqGrid(…) is null.

I use @version 2.6.3 build 20190926-0831

Thank you very much.

3 Answers
Javier Albornoz (Jujuy-Argentina) answered 4 years ago

Hi, I delete the line with error, but now select the new line in the grid sometimes. The gris is sorted by name. I dont know what is the problem. Thanks for your help!!!

Abu Ghufran Staff answered 4 years ago

This is default behavior to select newly added row. The newly added row should be there in the list. If you sort by ID descending and new record will always comes on top and show highlighted.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Javier Albornoz (Jujuy-Argentina) answered 4 years ago

Thanks, Abu!

Your Answer

9 + 13 =

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?