Kendo UI Dynamically Change Datasource String (XML)

前端 未结 1 738
无人共我
无人共我 2020-12-11 07:01

I have a Kendo Grid that binds to an XML DataSource. How can I have the DataSource change, based off the selection of a drop down list. Example:

//Create Dat         


        
相关标签:
1条回答
  • 2020-12-11 07:26

    I was able to achieve this by adding the following to the On Change event of my Drop Down list:

    //Assign drop down value to variable
    var dropDownListValue = $("#dropDown1").val();
    
    //Concatenate drop down variable to file name
    var dynamicUrl = dropDownListValue +".xml";
    
    //Assign grid to variable
    var grid = $("#grid").data("kendoGrid");
    
    //Set url property of the grid data source
    grid.dataSource.transport.options.read.url =dynamicUrl;
    
    //Read data source to update
    grid.dataSource.read();
    
    0 讨论(0)
提交回复
热议问题