jqgrid search/filter

前端 未结 1 1516
太阳男子
太阳男子 2021-01-26 01:57

this is related to my latest question in this link. i already figured out the whats the error why it displays \"Server Error: Parameter \'dataType\' is not specified\". It\'s th

相关标签:
1条回答
  • 2021-01-26 02:12

    The way which you use in your previous question I don't like not because of the usage of "global" variable filter but because of complicated logic. Especially strange I find that you discard many parameters of jqGrid inside of your implementation of the serializeGridData event handle. I am sure that the code can be much simplified, but you don't posted more full JavaScript code which you use. Even which HTTP method you use to communicate with the server (do you use mtype:"POST" parameter or not).

    Now about you main question. The variable filter should not be global. If should be visible. For example:

    $(document).ready(function () {
        var filter = ''; //this is NOT global variable
        $('#btnsearchCode').click(function(){
            filter="...any value..."; // you can change the value of filter here
            //...
            $('#list1').trigger('reloadGrid');
        });
    
        $('#list1').jqGrid({
            // define jqGrid where you can use filter if needed
            // either directly of inside of body of any function
        });
    });
    
    0 讨论(0)
提交回复
热议问题