I'm having a problem with regards to JQgrid.
here is my code for my grid.
i'm using clientsideevents of "beforerowselect" and "loadcomplete"
note: i'm using load complete for the reload of the grid
everytime the grid reloads it will select the item.
<trirand:JQGrid ID="jqgrid" runat="server" Height="475px" Width="1510px" MultiSelect="false" ShrinkToFit="true" AutoWidth="true">
<ClientSideEvents BeforeRowSelect="beforeSelect" LoadComplete="loadComplete"/>
In "beforeselectevent" what i do here is to get the cellvalue of
the rowid of "itemid".
I tried to create a session variable to store the value of the "ItemID"
and store it in the var sessionItemID for me to be able to pass it on "load complete event".
Problem: but everytime i tried to insert breakpoint here it always gives me '' value.
function beforeSelect(rowid, e) {
grid = $("#<%= jqgrid.ClientID %>");
ItemID = grid.jqGrid('getCell', rowid, 'ItemID');
var sessionItemID = '<%=Session["ItemID"] %>';
}
here in "loadcomplete" event. I passed the sessionItemID so that i can get the ItemID.
so everytime i update the item on the grid.
it will reload the page and select the item that i updated.
Problem: after it reloads, it doesn't select the item after it reloads.
function loadComplete(sessionItemID ) {
if (ItemID != 0 || ItemID != null) {
grid = $("#<%= jqgrid.ClientID %>");
grid.trigger("reloadgrid");
grid.jqgrid('setselection', "2" );
}
}
what i want to achieve is this (to make the story short)
1. select row on the grid, form will pop-up then update record.
2. after updating record the user will save the page then close.
3. grid will reload
4. it will remember the selected/updated item.
I'm really confused on what will i do next. Thanks