Click here to Skip to main content
15,891,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Got Error When Create JQGrid in Index View
i have also Load All Needed JS & CSS File for JQGrid
rather than i get Above Error in Firebug
Please Suggest me to Implement of JQGrid in Right Way or Help to Solve My Error
i have Declare My Code Bellow.

HTML
Include JS File---------
<pre lang="xml"><link href="~/Content/jqGrid/css/ui.jqgrid.css" rel="stylesheet" />
<link href="~/Content/jqGrid/css/ui.all.css" rel="stylesheet" />
<script src="~/Content/jqGrid/js/i18n/grid.locale-en.js"></script>
<script src="~/Content/jqGrid/js/jquery.jqGrid.js"></script>
<script src="~/Content/jqGrid/js/jquery.jqGrid.min.js"></script>
<script src="~/Content/jqGrid/js/jquery.jqGrid.src.js"></script>
<script src="~/Content/jqGrid/js/jquery.ui.all.js"></script>


---------html code --------
XML
<table id="student-grid-json"></table>
   <div id="pager-json"></div>


Java
$(document).ready(function (e)
{
   $("#student-grid-json").jqGrid
   ({
      url: '',
      datatype: 'json',
      mtype: 'GET',
      no_legacy_api : true,
      useJSON : true,
      colNames: ["Student ID", "Name", "Course", "Year"],
      colModel: 
      [
         { name: "StudentID", index: "StudentID" },
         { name: "Name", index: "Name" },
         { name: "Course", index: "Course" },
         { name: "Year", index: "Year", sorttype: "int" }
      ],
      multiselect: true,
      shrinkToFit: false,
      caption: 'Student List Loading via Array'
   });

   var students = [
      {StudentID:"JC200300001", Name:"Jessica Cohen", Course:"Applied Arts and Sciences", Year:"1" },
      {StudentID:"SF200800002", Name:"Shane Foster", Course:"Business Administration", Year:"2" },
      {StudentID:"KK200800003", Name:"Kellan Kher", Course:"Social Sciences", Year: "4" },
      {StudentID:"PS200100004", Name:"Patrick Shirazi", Course:"Education", Year:"1" },
      {StudentID:"CB200400005", Name:"Constance Barry", Course:"Social Sciences", Year:"3" },
      {StudentID:"DW200400006", Name:"Dustin Wallace", Course:"Philosophy", Year:"1" },
      {StudentID:"AG200900007", Name:"Amal Goodman", Course:"Education", Year:"2" }
   ];

   for (var x = 0; x <= students.length; x++)
   {
      $("#student-grid-json").addRowData(x, students[x]);
   }
});
Posted
Updated 23-Mar-16 3:02am
v3

1 solution

Why have you linked 3 files for the jQGrid. These three seems to be the same. Please declare only one and remove others.
XML
<script src="~/Content/jqGrid/js/jquery.jqGrid.js"></script>
<script src="~/Content/jqGrid/js/jquery.jqGrid.min.js"></script>
<script src="~/Content/jqGrid/js/jquery.jqGrid.src.js"></script>
 
Share this answer
 
Comments
Member 13239447 4-Jun-17 4:33am    
I am facing same issue but your solution dose not work for me??
Make sure jqGrid is there. You can check that in the developer console if it is getting included with the page or not.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900