Forum
jQuery(document).ready(function(){
var lastsel2
jQuery("#list2").jqGrid({
url:'edit.php?nd='+new Date().getTime(),
datatype: "json",
colNames:['id','name', 'type.','act'],
colModel:[
{name:'id',index:'id', width:55, sortable:false,editable: false},
{name:'name',index:'name', width:55,editable: false},
{name:'actual',index:'actual', width:60, align:"center",editable: true,edittype:"checkbox",editoptions: {value:"Yes:No"}},
{name:'act',index:'act', width:75, align:"center",sortable:false, editable:false} ],
rowNum:20,
rowList:[10,20,30,50,100],
imgpath: 'images',
pager: jQuery('#pager2'),
sortname: 'name',
viewrecords: true,
sortorder: 'asc',
loadComplete: function(){
var ids = jQuery("#list2").getDataIDs();
for(var i=0;i<ids.length;i++){
var cl = ids[i];
toact = "<div class=btosave title='Save' onclick=UserSave("+cl+");> </div>";
jQuery("#list2").setRowData(ids[i],{act:toact});
}
},
onSelectRow: function(id){
if(id && id!==lastsel2){
jQuery('#list2').restoreRow(lastsel2);
jQuery('#list2').editRow(id,true);
lastsel2=id; }
},
editurl: "edit.php"
});
});
var timeoutHnd;
var flAuto = false;
function doSearch(ev){
if(!flAuto) return;
var elem = ev.target||ev.srcElement;
if(timeoutHnd)
clearTimeout(timeoutHnd)
timeoutHnd = setTimeout(gridReload,500)
}
function gridReload(){
var nm_mask = jQuery("#item").val();
jQuery("#list2").setUrl("adminuserslist.php?nm_mask="+nm_mask);
jQuery("#list2").setPage(1);
jQuery("#list2").trigger("reloadGrid");
}
function enableAutosubmit(state){
flAuto = state;
jQuery("#submitButton").attr("disabled",state);
}
function adminUserSave(aid) {
jQuery('#list2').saveRow(aid,checksave);
}
function checksave(result){
if (result=="") {alert("Fatal error!"); return false;} jQuery("#list2").trigger("reloadGrid"); return true;
}
</script>
User can see table with data and can edit "type" column. user change type and press Enter - save data and fine. but if user change data and click on button Save - data save to server fine, server responce Ok and run event "checksave". this event work and set trigger("reloadGrid") - grid fill data from server. fine? fine but not - after that user click to another row and "lastrow" is restored with older data!!!
trigger("reloadGrid") isnt clear array data?
02:48
Moderators
30/10/2007
Hi,
Just try in this function - after grid reload use setGridParam({selrow:id})
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.
10:08
Moderators
30/10/2007
Check what is with lastsel2. I think you should d something with this if the button is clicked
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.
Most Users Ever Online: 715
Currently Online:
56 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