jqGrid: Reload Data

Tuizi picture Tuizi · Jun 8, 2011 · Viewed 9.3k times · Source

Here is my code:

    $('#ShowName').autocomplete({
        delay: 600,
        minLength: 0,
        source: function (request, response) {
            $.ajax({
                url: '<%: Url.Content("~/Case/FilterShowName") %>',
                data: getData(),
                success: function (data) { response(data); },
                dataType: "json"
            });
        },
        select: function (event, ui) {
            var data = getData();
            data.ShowName = ui.item.label;
            $("#list").setGridParam('postData', data);
            $("#list").trigger("reloadGrid");
        }
    });

As you can see, when an item is selected on $('#ShowName') I want to reload my $("#list")'s jqGrid. But when I do that, the new postData's values is never sended. Only the old values are sended to ~/Case/FilterShowName

I see different solution on Stackoverflow by recreating the entire grid. This is realy necessary?

Thank you!

Answer

Craig Stuntz picture Craig Stuntz · Jun 8, 2011

You should do:

$("#list").setGridParam({'postData': data});

Then it should work.