jqGrid记录文本定制
我需要自定义jqGrid jQuery插件中的jqGrid记录文本定制,jqgrid,Jqgrid,我需要自定义jqGrid jQuery插件中的记录文本:{0}-{1}{2} 在我的项目中,我使用了几个jqGrids,我想更改每个网格括号内的文本——我需要它们看起来像这样: 1-10 of 29 (Users) 1-10 of 29 (Administrators) 1-10 of 29 (Emails) jqGrid的语言文件(i18n/grid.locale en.js)中的默认recordtext)是: 您可以尝试以下方法: 在jqgrid的gridcomplete功能中,显式
记录文本:{0}-{1}{2}
在我的项目中,我使用了几个jqGrids,我想更改每个网格括号内的文本——我需要它们看起来像这样:
1-10 of 29 (Users)
1-10 of 29 (Administrators)
1-10 of 29 (Emails)
jqGrid的语言文件(i18n/grid.locale en.js
)中的默认recordtext
)是:
您可以尝试以下方法: 在jqgrid的gridcomplete功能中,显式地将所需文本添加到右侧寻呼机td。生成的寻呼机部分的td id将是“pager_right”。(您可以使用firebug进行确认)
gridComplete:函数()
{
var tableData=$('pager#u right')。查找('div');
span=$('(某些文本)');
tableData.append(span);
}
使用此代码
$("#grid").jqGrid('setGridParam', { recordtext: "View {0} - {1}" + " of " + Total}).trigger('reloadGrid');
在创建网格之前,可以对语言脚本使用extend方法
jQuery.extend($.jgrid,{
defaults : {
recordtext: "View {0} - {1} of (Users) {2}",
emptyrecords: "No records to view",
loadtext: "Loading...",
pgtext : "Page {0} of {1}"
},
});
在jqgrid定义中,只需覆盖recordtext参数。 例如,这就是我所做的
$myGrid = $('gridName)'
.jqGrid(
{
dataType : 'json',
scroll : true,
scrollOffset : 20,
scrollrows : true,
viewsortcols : [ true, 'horizontal', true ],
width : '100%',
height : '100%',
viewrecords : true,
recordtext: "Total Records : {2}",
....other parameters as you need them..
});
有关更多信息,请参阅
jQuery.extend($.jgrid,{
defaults : {
recordtext: "View {0} - {1} of (Users) {2}",
emptyrecords: "No records to view",
loadtext: "Loading...",
pgtext : "Page {0} of {1}"
},
});
$myGrid = $('gridName)'
.jqGrid(
{
dataType : 'json',
scroll : true,
scrollOffset : 20,
scrollrows : true,
viewsortcols : [ true, 'horizontal', true ],
width : '100%',
height : '100%',
viewrecords : true,
recordtext: "Total Records : {2}",
....other parameters as you need them..
});