我想将jqgrid的选项集中到一个javascript文件中,所有的网格都可以使用。比如它是否可排序、height、width以及onSelectRow和loadComplete等方法。然后,我想在不同的javascript文件中加载特定于该网格的选项,例如colModel、标题和排序顺序
GridMain.js
datatype: 'local',
height: 'auto',
width: 'auto',
pager: $('#pager'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortorder: "asc",
viewrecords: true,
sortable: true,
onSelectRow: function (id) {
//redirect to brand details page
document.location.href = url + id;
}UserGrid.js
colModel: [
{ name: 'Id', index: 'Id', hidden: true, key: true },
{ name: 'Name', index: 'Name', width: 250, align: 'left' },
{ name: 'Disabled', index: 'Deleted', width: 100, align: 'left' },
{ name: 'Actions', index: 'Actions', width: 150, align: 'center', sortable: false, title: false}],
sortname: 'Name',
caption: "Users"
});我尝试了许多不同的方法,但我似乎无法弄明白。我尝试使用setGridParam方法,但在创建网格后,无法更改高度、宽度和colModel。
我正在使用tableToGrid('.table- to - grid ',{ options });初始化我的网格
任何帮助都将不胜感激。谢谢
https://stackoverflow.com/questions/8324307
复制相似问题