Author Topic: refreshdataandview  (Read 2717 times)

lgauton

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 44
    • View Profile
refreshdataandview
« 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


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: refreshdataandview
« Reply #1 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 );