Forum
03:38
06/02/2010
Hi,
setSelection does not select the row, whose id is 2, right after a reloadGrid.
$("#training").setGridParam({url: 'index.php?func=trainingmgr&aAction=refreshData'});
$("#training").trigger("reloadGrid");
$("#training").jqGrid('setSelection', "2");
setSelection can select the row, whose id is 2, when you take this line out: $("#training").trigger("reloadGrid");
Anybody experience same issue?
Thanks
19:05
Moderators
30/10/2007
Hello,
Sorry no time to explain, but try this:
$("#training").setGridParam({url: 'index.php?func=trainingmgr&aAction=refreshData'});
$("#training").trigger("reloadGrid");
setTimeout(function(){
$("#training").jqGrid('setSelection', "2″);
}, 500);
It will be good if you explain why we should do it this way.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
16:10
01/04/2010
Hi,
I have the same problem in funktions like gridComplete and loadComplete. I do the following:
jQuery('#grid_orders').jqGrid('setSelection','1');
},500);
and I test this:
And no row is selected 🙁
Oh I always use the last version of JQGrid with JQuery in your download-zip
17:05
01/04/2010
Hi,
I have a similar problem. I would like to select the first row after a grid reloading.
What I tried did not do what I expected.
Here is my code :
$("#accountGrid").jqGrid({
url: g_account_url,
datatype: "json",
caption: "AccountList",
colNames:[ "account_id", "Label", "Currency", "Balance" ],
colModel:[
{name:"account_id",index:"account_id", width:1, hidden:true, key:true},
{name:"account_label",index:"account_label", width:180},
{name:"currency_code",index:"currency_code", width:180},
{name:"balance_amount",index:"balance_amount", width:180},
],
height: "150px",
autowidth: true,
onSelectRow: f_select_account,
loadComplete: function(){
$("#accountGrid").setSelection($("#accountGrid").getDataIDs()[0],true);
},
gridComplete: function(){
$("#accountGrid").setSelection($("#accountGrid").getDataIDs()[0],true);
}
});Thanks for your help,
Regards,
Aime
17:42
06/02/2010
Thanks Tony. Your workaround work for me.
I reset url to aAction=RefreshData before reloadding the grid because want to force server to query db. There are other cases where aAction=loadData which can be either query db if never queried before or reuse data stored in session if queried before. Just to save some performance.
Thanks again.
17:16
Moderators
30/10/2007
Hello,
@unknown
try this instead
$('#grid_waregroups tbody tr:first').trigger("click");
Note that I replace first-child with firs.
@Aime
a gridComplete should be used only. It is quiet possible that in loadComplete the row is selected, but in gridComplete it will be deselected – the setSelection is a toggle function.
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
20:16
09/11/2010
I'm having the same problem with version 4 of JQGrid.
What I found was that after a trigger("reloadGrid"); the setSelection scrolls to the position, selects the row in the background BUT it will not make the selection visible. Only after I sort the data or click refresh it will select the item. My grid type is JSON.
I know that the setSelection in the background selects the row because I have a reload of another grid onSelectRow. That problem here is that the Row is not getting the CSS Classes ui-state-hover ui-state-highlight.
UPDATE: Just found that If I call $("#grid").jqGrid("resetSelection"); before the SetSelection the Selection is made in the GridComplete!
15:21
21/09/2011
I have a jqGrid created when my page loads.
When I update or delete a row I use the methods setRowData or delRowData to update the grid withour reloading it.
Yet when I add a row, I cannot use addRowData because the sorting is wrong.
So I add the row in the database and then reload the grid.
But I want the new inserted row selected.
So I call setSelection, but the reloadGrid fires after the setSelection and so my row is not selected.
So I need to assign a callback to the loadComplete event, but my grid is already created when I want to assign the callback to the loadComplete event... is there a way to do this?
08:35
Moderators
30/10/2007
Hello,
You canb call setSelection AFTER reload the grid and not before.
Also a good choice is to call setSelection with setTimeout function to give a grid a time to refresh its data.
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
21 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66