有没有办法从 JQueryUI 添加第二个工具栏到现有的 JQGrid。
最佳答案
您可以使用 jqGrid 的 toolbar: [true, "bottom"]
选项在网格底部添加附加工具栏。网格的 id 将由 't_'
前缀和网格 id 构建。您可以手动将任何信息添加到网格中。例如以下代码添加简单的 jQuery UI Button :
$('<div><span id="myToolbar" style="float: right;"></span></div>').appendTo("#t_" + $grid[0].id);
$('<button>', {title: 'Click me!'}).css({
float: "right",
height: "21px",
width: "20px"
}).appendTo("#myToolbar").button({
icons: {
primary: "ui-icon-gear"
},
text: false
}).click(function (e) {
alert('My button was clicked');
});
您可以在 the demo 上看到结果:
(我将光标放在按钮上以显示工具提示“单击我!”)
关于jquery - 使用 JQuery 将第二个工具栏添加到 JQGrid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8441122/