Skip to main content

Kendo UI Grid : Change datasource url on Grid

Hi,

I've got a dropdown and a grid. The idea is to change the data displayed in the grid depending on the selection made in the dropdown.
The datasource uses a json service. When the page is loaded the grid is filled with the data from the json service. After changing the selection in the dropdown the transport url is changed according to the alert. But capturing the network traffic reveals that the original url is called instead of the one with the new parameter. 

The html excerpt:
<input id="ddlFacility" />
 
<div id="SiteOverviewTabStrip">
            <ul>
                <li class="k-state-active">Regional dashboard</li>
                <li>Production summary</li>
            </ul>
            <div class="placeholder table">
                <div id="regionalGrid">
                </div>
            </div>
            <div class="placeholder graph">
                <div id="productionGrid">
                </div>
            </div>
</div>


The script:
// bind to the change event and update the data source url
 var ddlFacility = $("#ddlFacility").data("kendoDropDownList");
ddlFacility.bind("change"function () {
     var grid = $("#regionalGrid").data("kendoGrid");
     grid.dataSource.options.transport.read.url ="/_layouts/SharePoint.Services/ProxyService.svc/GetFacilityRegionalData?origin=" +this.value();
 
  grid.dataSource.read();      grid.refresh();
  alert(grid.dataSource.options.transport.read.url);});


Ref : http://www.kendoui.com/forums/kendo-ui-web/grid/change-datasource-url-on-grid.aspx

Comments

Post a Comment