how to reload jqgrid in asp.net mvc when i change dropdownlist

前端 未结 2 1291
北荒
北荒 2020-12-15 14:29

what is wrong in this code? when i change drop down list,the grid takes old value of ddl only, not taken newely selected values why?

<%--

        
相关标签:
2条回答
  • 2020-12-15 14:47

    Another option is jQuery("#list").jqGrid().setGridParam({url : 'newUrl'}).trigger("reloadGrid")

    0 讨论(0)
  • 2020-12-15 15:00

    you can just define

    jQuery("#list").jqGrid({
        url: gridDataUrl,
        postData: {
            StateId: function() { return jQuery("#StateId option:selected").val(); },
            CityId: function() { return jQuery("#CityId option:selected").val(); },
            hospname: function() { return jQuery("#HospitalName").val(); }
        }
        // ...
    });
    

    and call trigger("reloadGrid") at change or click events.

    I recommend you use current version of jqGrid from http://www.trirand.com/blog/?page_id=6 (don't forget select all modules which you need before download). For documentation see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs. You can use jQuery 1.4.2 with jQuery UI 1.8.1 with any of jQuery themes. jqGrid theme "coffee" is deprecated and gridimgpath you needs no more. Table "list" and div "pager" can be defined also just like

    <table id="list"></table> 
    <div id="pager"></div> 
    

    see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid.

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