如何在 jqgrid 高级搜索对话框中本地化按钮工具提示

2022-01-19 00:00:00 javascript jqgrid

似乎工具提示 Add subgroupAdd ruleDelete rule 在 jqgrid 代码中是硬编码的.

 inputAddSubgroup = $("

如何本地化它们?

解决方案

我已将我的详细信息发布到 trirand

我使用了以下代码

$.extend($.jgrid.search, {多重搜索:真,多组:真,重新创建过滤器:真,closeOnEscape:真,closeAfterSearch:真,覆盖:0,重绘后:函数(){$('input.add-rule',this).button().val('添加新规则').attr('title', '我的添加新规则工具提示');$('input.add-group',this).button().val('添加新组或规则').attr('title', '我的新组或规则工具提示');$('input.delete-rule',this).button().val('删除规则').attr('title', '我的删除规则工具提示');$('input.delete-group',this).button().val('删除组').attr('title', '我的删除组工具提示');$(this).find("table.group:not(:first)").css({边框宽度:1px",边框样式:虚线"});}});

我在组中添加了额外的边框,因为我觉得那里很有帮助.

It seems like tooltips Add subgroup, Add rule, Delete rule are hard coded in jqgrid code.

            inputAddSubgroup = $("<input type='button' value='+ {}' title='Add subgroup' class='add-group'/>");

How to localize them?

解决方案

I posted to trirand my detailed suggestion and reminded Tony twice about the problem later.

Additionally I described in the answer a workaround which allows to customize the Advanced searching dialog

Simple modification of the original demo make the following new demo

I used the following code

$.extend($.jgrid.search, {
    multipleSearch: true,
    multipleGroup: true,
    recreateFilter: true,
    closeOnEscape: true,
    closeAfterSearch: true,
    overlay: 0,
    afterRedraw: function () {
        $('input.add-rule',this).button().val('Add new rule')
            .attr('title', 'My Add new rule tooltip');
        $('input.add-group',this).button().val('Add new group or rules')
            .attr('title', 'My new group or rules tooltip');
        $('input.delete-rule',this).button().val('Delete rule')
            .attr('title', 'My Delete rule tooltip');
        $('input.delete-group',this).button().val('Delete group')
            .attr('title', 'My Delete group tooltip');
        $(this).find("table.group:not(:first)").css({
            borderWidth: "1px",
            borderStyle: "dashed"
        });
    }
});

I added additional border in groups because I find there helpful.

相关文章