Forum
23:29
16/05/2014
I was running 3.5.3 with jQuery 1.7.1v and wanted to upgrade to 4.6.0. PHP 5.3, MySQL 5.1, Apache 2.2
My data loads from the server echo json_encode($response); produces the following output (with testing data):
However, no grid is displayed. My jQuery code is as fallows:
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid.jqGrid-4.6.0/css/ui.jqgrid.css" />
<script src="jquery.jqGrid-4.6.0/js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="jquery.jqGrid-4.6.0/js/jquery-ui-custom.min.js" type="text/javascript"></script>
<script src="jquery.jqGrid-4.6.0/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="jquery.jqGrid-4.6.0/plugins/ui.multiselect.js" type="text/javascript"></script>
<script src="jquery.jqGrid-4.6.0/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="jquery.jqGrid-4.6.0/plugins/jquery.tablednd.js" type="text/javascript"></script>
<script src="jquery.jqGrid-4.6.0/plugins/jquery.contextmenu.js" type="text/javascript"></script>
<!– <script src="jqgrid.jqGrid-4.6.0/src/grid.loader.js" type="text/javascript"></script> –>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#person_list").jqGrid({
url:'server-update.php?q=1',
datatype: "json",
colNames:['ID','Type','Last','First','Email','Phone','Address','Custom','Registrations','Balance Due'],
colModel:[
//{name:'', sortable:true, index:'a.personType', width:25, hidden:false,search:false,hidedlg:true},
//search ID on
//{name:'', index:'a.personID', width:20, hidden:false,searchoptions:{sopt:['bw','cn','eq','ne','lt','gt','ew']}},
//search ID off
{name:'personID', index:'a.personID', width:20},
{name:'isStudent', index:'isStudent', sortable:true, width:25},
{name:'lastName', index:'a.lastName', width:40},
{name:'firstName', index:'a.firstName', width:30},
{name:'email', sortable:true, index:'a.emailAddress', width:60},
{name:'phone', sortable:false,index:'phone', width:35},
{name:'address', sortable:false,index:'address', width:100},
],
rowNum:7,
autowidth: true,
pager: '#pagerb',
sortname: 'lastName',
rowList:[10,20,50,100],
viewrecords: true,
sortorder: "asc",
caption: "JSON Example",
});
jQuery("#person_list").jqGrid('navGrid','#pagerb',{edit:false,add:false,del:false});
</script>
<div id="pagerb" class="scroll" style="text-align:center;"></div>
Can someone tell me why this does not display the data in the grid format?
Blessings!
12:34
Moderators
30/10/2007
Hello,
You have 2 errors in the example you provide:
1. The elements in colNames are diffrent from thise in colModel
2. In the response there is a error - a "is missed.
You have
...
{"id":"1031","cell":["1031","Hoyt","TempName5,"","angels@gmail.com",null,"1"]}
...
but it should be
...
{"id":"1031","cell":["1031","Hoyt","TempName5","","angels@gmail.com",null,"1"]}
...
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.
17:33
16/05/2014
Ok I updated the code to
colModel:[
//{name:'', sortable:true, index:'a.personType', width:25, hidden:false,search:false,hidedlg:true},
//search ID on
//{name:'', index:'a.personID', width:20, hidden:false,searchoptions:{sopt:['bw','cn','eq','ne','lt','gt','ew']}},
//search ID off
{name:'personID', index:'a.personID', width:20},
{name:'Type', index:'isStudent', sortable:true, width:25},
{name:'lastName', index:'a.lastName', width:40},
{name:'firstName', index:'a.firstName', width:30},
{name:'email', sortable:true, index:'a.emailAddress', width:60},
{name:'middleName', sortable:false,index:'middleName', width:35},
{name:'address', sortable:false,index:'address', width:100},
],
But it still does not work.
14:39
Moderators
30/10/2007
Hello,
You should fix the second problem with the response. Do you have fix it.
I have a working demo with your json response, but fixed.
Kind Regards
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.
14:43
16/05/2014
Yes, I did fix the second problem…it wasn't so much a problem because it was a typo that occurred after I changed the text so as to not give out person information.
Would you kindly share the working demo : )
Blessings,
Tiffany
14:51
Moderators
30/10/2007
Hello,
Here you are - Look at this example
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:
37 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