开发者

jqgrid pass value throught url for ASP.NET MVC Controller

开发者 https://www.devze.com 2022-12-08 00:56 出处:网络
I have a jqGrid script like that: jQuery(document).ready(function() { var startDate = $(\"#startDate\").Val();

I have a jqGrid script like that:

jQuery(document).ready(function() {

var startDate = $("#startDate").Val();
jQuery("#sandgrid").jqGrid({
    url: 开发者_如何学编程"/Deposit/Search?startDate='" + startDate + "'",
    datatype: 'json',
    mtype: 'GET',
    height: 255,
    width: 700,
    colNames: ['Index', 'Name', 'Code'],
    colModel: [
            { name: 'item_id', index: 'item_id', width: 65 },
            { name: 'item', index: 'item', width: 150 },
            { name: 'item_cd', index: 'item_cd', width: 100}],

    pager: jQuery('#sandgridp'),
    rowNum: 10,
    rowList: [5, 10, 20, 50],
    sortname: 'item_id',
    sortorder: "desc",
    viewrecords: true,

    caption: 'My Grid'
});

});

In the view, there also have a input text box:

         <td>
             <% Html.jQuery().DatePicker()
                .Name("startDate")
                .Render(); %>           
        </td>

What I want to do is to pass the value from "startDate" to call jqGrid's url: "/Deposit/Search?startDate='" + startDate + "'". But it seems the data does not pass into the url. WHat is the issue? Is any other approach available for doing a searching function with jqGrid?

Thanks a lot!!


Set new url and then reload grid:

jQuery("#sandgrid").jqGrid().setGridParam({url : '/Deposit/Search?startDate=' + $("#startDate").datepicker('getDate')}).trigger("reloadGrid")

0

精彩评论

暂无评论...
验证码 换一张
取 消