ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: lgauton on June 02, 2014, 12:40:55 pm

Title: refreshdataandview
Post by: lgauton on June 02, 2014, 12:40:55 pm
Hi I have a grid with datamodel

                var dataModelhl = {
                    //cache: true,
                    location: "remote",
                    sortDir: "up",
                    sortIndx: 1,
                    sorting: "local",
                    dataType: "xml",
                    method: "POST",
                    getUrl: function () {
                        return {
                            url: "@Url.ModuleUrl().Action("AccessHotelList")",
                            data: { 'id': ctr }
                        };
                    },
                    getData: function (dataDoc) {
                        //debugger;
                        var obj = { itemParent: "BriefAccommodationInfo", itemNames: ["code", "name", "inactive", "resortCode", "resortName", "countryCode", "countryName"] };
                        return { data: $.paramquery.xmlToArray(dataDoc, obj) };
                    }
                };

How can I change the value of id

url: "@Url.ModuleUrl().Action("AccessHotelList")",
                            data: { 'id': ctr }

prior to a refreshDataAndView request

Title: Re: refreshdataandview
Post by: paramvir on June 02, 2014, 05:47:58 pm
It can be done by setting the option dataModel.getUrl.

var newgetUrl = function (){
  return {
             url: "@Url.ModuleUrl().Action("AccessHotelList")",
             data: { 'id': newctr }
       };
}

$grid.pqGrid( 'option', 'dataModel.getUrl', newgetUrl );