1

我正在尝试向 JQGrid 中的 tilebar 添加多个图标。我使用某种破解的 JQuery 添加了 1,但我需要它们并排在折叠按钮旁边。我的解决方案似乎很不雅。

这是我添加 1 个图标的代码(我需要 3 个图标,可能是 4 个)

$("#grid").setCaption('Title Goes Here' + '<span style="margin-left:200px;"></span>' + '<input type="image" id="icon_test" src="img/pencil_icon.png" onclick="icon_test_click();" title="#" />');
4

2 回答 2

2

这是一个示例,我将按钮附加到我的 jqGrid 标题栏:

    $('.ui-jqgrid-title').after('<div id="jqGridButtonDiv"><button id="Button1Id" type="button" class="titlebutton ui-button ui-widget ui-state-default ui-corner-all '+
                                'ui-button-text-only" role="button">Button Text</button></div>')
                        .after('<div id="YourCollectionFoilToggleDiv"><button id="Button2Id" type="button" class="titlebutton ui-button '+
                        'ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">Button Text</button>  </div>');

然后一些 CSS 将它们设置为向右浮动并带有一些填充。

#jqGridButtonDiv{float:right; padding-right:50px; position:relative; top:-1px;}

您应该能够轻松地调整它以将按钮更改为图标等。

于 2013-03-01T00:09:37.820 回答
0

I had a similar requirement; however, I have multiple grids on the same screen. Using Mark's solution, along with his CSS, and changing the selector to use 'gview_id' (where id is the gridId), I was able to zero in on the specific grid:

$('#gview_id span.ui-jqgrid-title').after('<button id=jqGridTitleButtonId class="ui-button ui-icon ui-icon-newwin"></button>');        
$('#jqGridTitleButtonId').click(function() {
        ...code here...
});
于 2013-04-22T14:15:37.940 回答