使用JQuery向JQGrid添加第二个工具栏

时间:2011-12-09 04:35:09

标签: jquery jquery-ui jquery-plugins jqgrid

有没有办法从JQueryUI向现有JQGrid添加第二个工具栏。

1 个答案:

答案 0 :(得分:3)

您可以使用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上看到结果:

enter image description here (我将光标放在按钮上以显示工具提示“点击我!”)