添加 'done' 回调时,jqGrid 列选择器不会对列顺序进行排序
jqGrid column chooser doesn't sort the column order when adding a 'done' callback
我的列选择器运行良好。
当我添加 'done' 回调函数(即使是一个空函数)时,一切正常,但列的顺序 - 似乎我放置的任何顺序都没有效果。
代码如下:
$('#jqGrid').jqGrid('navButtonAdd', '#jqGridPager', {
caption: "",
buttonicon: "ui-icon-calculator",
title: "Choose columns",
onClickButton: function () {
$('#jqGrid').jqGrid('columnChooser',{
width: 550,
msel_opts: {dividerLocation: 0.5},
modal: true,
//To Do - calling the done event cancelling the reorder of the column - need to find out why.
done: function() {
$('#jqGrid').setGridParam({ postData:sessionListData(pageOffset,sortingAddition,pageLength,$(this)) }).trigger("reloadGrid");
$(window).resize(function() {
sessionList(pageOffset,$(this),sortingAddition,pageLength);
$("#jqGrid").jqGrid('setGridWidth', $('.ui-layout-center').width() + 5, true);
}).trigger('resize');
}
});
$("#colchooser_" + $.jgrid.jqID(this.id) + ' div.available>div.actions')
.prepend('<label style="float:left;position:relative;margin-left:0.6em;top:0.6em">Search:</label>');
var d=$("div.ui-dialog[aria-labelledby='ui-dialog-title-colchooser_list']");
d.height(530);
$("div#colchooser_list").height(400);
$("div.selected, div.available").height(350);
$("div.selected, div.available","div#colchooser_list").height(350);
}
});
这不是错误。 the documentation 中描述了它的行为。您可以将 done
想象成您可以覆盖的虚拟方法。通过覆盖,您必须实现原始回调的行为。
我的列选择器运行良好。 当我添加 'done' 回调函数(即使是一个空函数)时,一切正常,但列的顺序 - 似乎我放置的任何顺序都没有效果。
代码如下:
$('#jqGrid').jqGrid('navButtonAdd', '#jqGridPager', {
caption: "",
buttonicon: "ui-icon-calculator",
title: "Choose columns",
onClickButton: function () {
$('#jqGrid').jqGrid('columnChooser',{
width: 550,
msel_opts: {dividerLocation: 0.5},
modal: true,
//To Do - calling the done event cancelling the reorder of the column - need to find out why.
done: function() {
$('#jqGrid').setGridParam({ postData:sessionListData(pageOffset,sortingAddition,pageLength,$(this)) }).trigger("reloadGrid");
$(window).resize(function() {
sessionList(pageOffset,$(this),sortingAddition,pageLength);
$("#jqGrid").jqGrid('setGridWidth', $('.ui-layout-center').width() + 5, true);
}).trigger('resize');
}
});
$("#colchooser_" + $.jgrid.jqID(this.id) + ' div.available>div.actions')
.prepend('<label style="float:left;position:relative;margin-left:0.6em;top:0.6em">Search:</label>');
var d=$("div.ui-dialog[aria-labelledby='ui-dialog-title-colchooser_list']");
d.height(530);
$("div#colchooser_list").height(400);
$("div.selected, div.available").height(350);
$("div.selected, div.available","div#colchooser_list").height(350);
}
});
这不是错误。 the documentation 中描述了它的行为。您可以将 done
想象成您可以覆盖的虚拟方法。通过覆盖,您必须实现原始回调的行为。