几年前我创建了一个 php+smarty 应用程序,我在其中使用了 jqGrid。
这些是版本号:jQuery 1.2.6, jqGrid 3.2.3
那时它工作得很好。
几天前我检查它不起作用。更奇怪的是,它在 ie8 上运行,在 firefox 和 chrome 浏览器上失败。
我通过firefox中的firebug控制台检查我收到以下错误:
TypeError: jQuery(...).jqGrid is not a function
我无法理解为什么突然出现这个错误?
我已包含以下文件:
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid/themes/style.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jqgrid/themes/basic/grid.css" />
<script src="jqgrid/js/jquery.js" type="text/javascript"></script>
<script src="jqgrid/js/jquery.jqGrid.js" type="text/javascript"></script>
<script src="jqgrid/js/myjqGrid.js" type="text/javascript"></script>
jqGrid代码:
jQuery(document).ready(function(){
jQuery("#superadmin").jqGrid({ // Specify the ID of the Grid Table
url:'jqgrid/superadminusers.php', // URL of PHP file
datatype: "json", // Name of datatype
colNames:['User Id','First Name','Last Name', 'Role', 'Contact','Edit','Delete','Status'], // Column Name in grid
colModel:[ // Field name used in database
{name:'username',index:'username', width:100},
{name:'firstname',index:'firstname', width:120},
{name:'lastname',index:'lastname', width:100},
{name:'role',index:'role', width:100},
{name:'phone',index:'phone', width:80},
{name:'editrow',index:'editrow', width:50},
{name:'deleterow',index:'deleterow', width:50},
{name:'deletebook',index:'deletebook', width:100}
],
pager: jQuery('#divPage'), // ID of Grid DIV
rowNum:10, // Total no of rows that we want to show in grid at a time
mtype: "POST", // method type
height: 200, // height of grid
width: 850, // width of grid
multiselect: false, // set true the multiselect property
rowList:[10,15,20], // set the number of list of rows
imgpath: 'jqgrid/themes/sand/images', // path of images
sortname: 'username', // column name by which grid will be sorted by default
viewrecords: true, // it will show the number of records below the grid
sortorder: "asc",
caption:'Users'
});
});
我无法将其更新到最新的 jqGrid 版本,因为我必须手动更改所有文件中的代码。我使用的主题在 jquery ui 主题中也不可用。