Forum
15:38
05/10/2010
Hi, I work with big sets of data, and many users so I need the grid do most of the work on client side, I mean sorting by columns, pagination, etc, but reload by ajax, when users do a new search.
Is that possible?
I looked at this post: http://www.trirand.com/blog/?p.....;search=11
But did´nt worked, it relaods fine, but when tries to sort the grid goes empty.
Is there any work around or maybe I´m missing a property that allows what I need?
Thanks in advance.
15:03
05/10/2010
Ok, I figured it out, modifing a bit the "search bigset " example I achived what I needed, here is the code:
jQuery("#bigset").jqGrid({
url:'datos',
datatype: "json",
height: 255,
colNames:['Index','Name', 'Code'],
colModel:[
{name:'item_id',index:'item_id'},
{name:'item',index:'item'},
{name:'item_cd',index:'item_cd'} ],
rowNum:10,
rowList:[10,20,30],
mtype: "POST",
width:796,
hidegrid:true,
loadonce: true,
pager: '#pagerb',
sortname: 'item_id',
viewrecords: true,
sortorder: "asc"
});
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_nm").val();
var cd_mask = jQuery("#search_cd").val();
jQuery("#bigset").jqGrid('setGridParam',{datatype:'json'});
jQuery("#bigset").jqGrid('setGridParam', {url:"buscar?nm_mask="+nm_mask+"&cd_mask="+cd_mask,page:1}).trigger("reloadGrid");
}
The key here is initializing the grid with loadonce:true, and datatype:'json', then before reloding the grid we change the datatype:'json', again.
The result, the grid reloads by ajax, and does paging and sorting on client side.
Bye.
Most Users Ever Online: 715
Currently Online:
52 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