Evidently the grid will not track row numbers as ID’s independently, even after turning row numbers on this would not work. I had to add the following code to make it work; key:true.
Â
|
1 |
{name:"date",width:28, key:true}, |
bump – I still have not been able to find a working example if anybody has any suggestions.
This is what you are returning with your code;
|
1 2 3 4 5 6 7 |
"total": 91,<br /> Â "per_page": 10,<br /> Â "current_page": 1,<br /> Â "last_page": 10,<br /> Â "from": 1,<br /> Â "to": 10,<br /> Â "data": [ |
Â
If you would have actually compared to what I was sending you would have noticed your parameters are not set correctly for pagination to work. One example – total is the total number of pages (the way I set it), you are setting it to the total number of records. The parameter I am setting (note – I didn’t simply name my own I set them according to the documentation) for the current page is simply ‘page’, you are using current_page. If you analyze and adapt what I posted, or read the documentation on naming conventions, you should have no problem getting it to work.
you’re welcome…
I over complicated this response and ended up simply wasting time when the solution was exactly as you stated. Code is posted below;
Â
        Â
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
         $('#grid').jqGrid('navButtonAdd', '#pager', {<br />                caption: "",<br />                title: "Toggle Search Toolbar",<br />                buttonicon: 'ui-icon-search',<br />                onClickButton: function () {<br />                    this.toggleToolbar();<br />                    if ($.isFunction(this.p._complete)) {<br />                        if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible'))<br />                   {<br />                      <br />                            $('.ui-search-toolbar', this.grid.fhDiv).show();<br />                        } else {<br />                            $('.ui-search-toolbar', this.grid.fhDiv).hide();<br />                        }<br />                        this.p._complete.call(this);<br />                        fixPositionsOfFrozenDivs.call(this);<br />                    }<br />                }<br />            });<br />          $('.ui-search-toolbar').hide(); |
Fixed, FINALLY! I had to locate the nav bar inside of the closing }); as noted below…
  Â
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
jQuery(document).ready(function()<br /> Â Â Â Â Â Â { jQuery("#grid").jqGrid({<br /> Â Â Â Â Â Â Â Â Â Â Â Â url: "getinfo.php",<br /> Â Â Â Â Â Â Â Â Â Â Â Â datatype: "json",<br /> Â Â Â Â Â Â Â Â Â Â Â Â mtype: 'POST',<br /> Â Â Â Â Â Â Â Â Â Â Â Â autowidth: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â height: 330,<br /> Â Â Â Â Â Â Â Â Â Â Â Â colNames: ["Name", "Num", "Field", "Pad", "API", "Legal", "County, State",<br /> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "Lease", "Unit CA PA", "Status", "Updated", "Wildlife Stips", "Notes"],<br /> Â Â Â Â Â Â Â Â Â Â Â Â colModel: [<br /> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â { name: "well_name", width: 48,sortable: true, search:true},<br /> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â { name: "well_num", width: 18,sortable: true},<br /> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â { name: "field", width: 48,sortable: true, search:true},<br /> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ...<br /> Â Â Â Â Â Â Â Â Â Â Â Â ],<br /> Â Â Â Â Â Â Â Â Â Â Â Â rowNum:10,<br /> Â Â Â Â Â Â Â Â Â Â Â Â rowList:[10,25,50,10000],<br /> Â Â Â Â Â Â Â Â Â Â Â Â pager : '#pager',<br /> Â Â Â Â Â Â Â Â Â Â Â Â sortname: 'field',<br /> Â Â Â Â Â Â Â Â Â Â Â Â viewrecords: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â rownumbers: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â gridview: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â sortorder: "asc",<br /> Â Â Â Â Â Â Â Â Â Â Â Â caption:"Master Well List Maintenance"<br /> Â Â Â Â Â Â Â Â Â });<br /> Â Â Â Â Â Â Â Â Â jQuery("#grid").jqGrid('navGrid','#pager',<br /> Â Â Â Â Â Â Â Â Â {<br /> Â Â Â Â Â Â Â Â Â Â Â Â view: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â del: false,<br /> Â Â Â Â Â Â Â Â Â Â Â Â add: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â edit: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â search: true,<br /> Â Â Â Â Â Â Â Â Â Â Â Â refresh: true<br /> Â Â Â Â Â Â Â Â Â },<br /> Â Â Â Â Â Â Â Â Â { /*prmEdit*/ },<br /> Â Â Â Â Â Â Â Â Â { /*prmAdd*/ },<br /> Â Â Â Â Â Â Â Â Â { /*prmDel*/ } ,<br /> Â Â Â Â Â Â Â Â Â {<br /> Â Â Â Â Â Â Â Â Â Â Â Â /*prmSearch*/<br /> Â Â Â Â Â Â Â Â Â Â Â Â multipleSearch:true<br /> Â Â Â Â Â Â Â Â Â },<br /> Â Â Â Â Â Â Â Â Â { /*prmView*/ }<br /> Â Â Â Â Â Â Â Â Â );<br /> Â Â Â Â Â Â }); |
|
1 |
 |
Mine works fine and this is what I am sending back (and how I am sending it). I doubt my queries will do much good, I’m using mssql.
Â
|
1 2 3 4 5 6 7 8 |
$page = $_POST;<br /> $rows = $_POST;<br /> <br /> $data=$rowcnt;<br /> $data=$page;<br /> $data=$rowcnt/$rows;<br /> $data=$result; //this is the data set from the query<br /> echo json_encode($data); |
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top