Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
work client side (sort, pagination), but reload when needed
05/10/2010
15:38
Avatar
maxif
Uruguay
Member
Members
Forum Posts: 3
Member Since:
05/10/2010
sp_UserOfflineSmall Offline

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.

06/10/2010
15:03
Avatar
maxif
Uruguay
Member
Members
Forum Posts: 3
Member Since:
05/10/2010
sp_UserOfflineSmall Offline

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.

20/03/2013
20:01
Avatar
Deep Shah
New Member
Members
Forum Posts: 2
Member Since:
20/03/2013
sp_UserOfflineSmall Offline

Thanks maxif.

Finally i got it with

loadonce:true

 and 

 jQuery("#bigset").jqGrid('setGridParam',{datatype:'json'});
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information