Jqrid-Search Dialog-How to localize groupOps Text Values “AND” and “OR”

后端 未结 1 444
不思量自难忘°
不思量自难忘° 2021-01-25 06:06

I have a jqgrid which i enabled multiple search for and i wanna change the \"AND\" and \"OR\" group operation texts to their corresponding values in my native language.

相关标签:
1条回答
  • 2021-01-25 07:01

    It's a good question! +1 from me.

    The current jqGrid code build corresponding <select> element using the same values for the displayed text and the value attribute used in the query. As a workaround I suggest you the define the function updateGroupOpText

    var updateGroupOpText = function ($form) {
            $('select.opsel option[value="AND"]', $form[0]).text('My ADD');
            $('select.opsel option[value="OR"]', $form[0]).text('My OR');
            $('select.opsel', $form[0]).trigger('change');
        };
    

    and use it as the event handler for onInitializeSearch and afterRedraw events:

    jQuery("#kontrollist").jqGrid('navGrid', '#controllistpager',
        { add: false, edit: false, del: false },
        {}, {}, {},
        { // search options
            multipleSearch: true,
            onInitializeSearch: updateGroupOpText,
            afterRedraw: updateGroupOpText
        }
    );
    

    See the corresponding demo here, which displays the dialog like the following:

    enter image description here

    You should just change "My ADD" and "My OR" to the texts which you want.

    0 讨论(0)
提交回复
热议问题