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_Related Related Topics sp_TopicIcon
jqGrid lazy loading paging data
28/06/2013
17:48
Avatar
springuser
New Member
Members
Forum Posts: 2
Member Since:
28/06/2013
sp_UserOfflineSmall Offline

I have a requirement to display 2000 records and display only 20 per page. Pagination should help navigate to rest of the pages. This is the normal behaviour and I could able to do that.

But Not all 2000 records are available at same time. I want jqGrid send request to server when user clicks in paging to render the next page data.  Initiall I will provide 20 (per page) records and total count json object.  I tried to provide the total records and page number in jsonReader attribute, but jqGrid shows the pagination based on actual data provided.

How this lazy loading works with jqGrid, and any working examples would help.

-springuser

28/06/2013
18:12
Avatar
springuser
New Member
Members
Forum Posts: 2
Member Since:
28/06/2013
sp_UserOfflineSmall Offline

here is my sample code I copied from demo's. Still it doesn't work. data in rows and pagination links is not beeing displayed properly.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1″>
<title>jqGrid</title>

    <link rel="stylesheet" type="text/css" media="screen" href="../css/jqGrid 4.5.2/css/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../cssjquerycssredmondjquery-ui-1.10.3.custom.css" />

    <script src="../js/jquery/js/jquery-1.9.1.js"></script>
    <script src="../js/jquery/jqGrid 4.5.2/js/i18n/grid.locale-en.js"></script>
    <script src="../js/jquery/jqGrid 4.5.2/js/jquery.jqGrid.min.js"></script>

    <script type="text/javascript">

        $(document).ready(function () {
            
            
            var myData = {
                    "page":"2″,
                    "total":2,
                    "records":"13″,
                    "rows":[
                        {"id":"3",
                        "cell":["3","2007-10-02","Client 2","300.00","60.00","360.00","note invoice 3 & and amp test"]},
                        {"id":"2″,
                        "cell":["2","2007-10-03","Client 1","200.00","40.00","240.00","note 2"]},
                        {"id":"1″,
                        "cell":["1","2007-10-01","Client 1","100.00","20.00","120.00","note 1"]}
                        ],
                    "userdata":{"amount":600,"tax":120,"total":720,"name":"Totals:"}
                },grid = $("#list2″);
            
            
            
                jQuery("#list2″).jqGrid({
                            //url:'server.php?q=2',
                            datatype: "json",
                            
                            datatype:'local',
                            data: myData.rows,
                            
                            colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'],
                            colModel:[ {name:'id',index:'id', width:55},
                                       {name:'invdate',index:'invdate', width:90},
                                       {name:'name',index:'name asc, invdate', width:100},
                                       {name:'amount',index:'amount', width:80, align:"right"},
                                       {name:'tax',index:'tax', width:80, align:"right"},
                                       {name:'total',index:'total', width:80,align:"right"},
                                       {name:'note',index:'note', width:150, sortable:false}
                                      ],
                             rowNum:10,
                             rowList:[10,20,30],
                             pager: '#pager2',
                             sortname: 'id',
                             viewrecords: true,
                             sortorder: "desc",
                             caption:"JSON Example"
                });
                jQuery("#list2″).jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});        
        });    // $(document).ready(function () {
            
    
    </script>

    </head>
    <body>
                    
    <hr>

    
    

    <table id="list2″></table> <div id="pager2″></div>

    </body>
    </html>        
        
       

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
65 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