I've tried to write a Cascading DropDownList with JSON data source but it failed. Here is the code:
<script> $(document).ready(function() { $("#p_year").kendoDropDownList({ optionLabel: "Select Tax Year...", dataTextField: "YEARNAME", dataValueField: "YEARID", dataSource: { serverFiltering: true, transport: { read: "pykirxb_payr_ln.p_json_read_year" } } }); var data = [ { text: "IR56E", REPORTID: "IR56E" }, { text: "IR56F", REPORTID: "IR56F" }, { text: "IR56G", REPORTID: "IR56G" } ]; // create DropDownList from input HTML element $("#p_report_type").kendoDropDownList({ dataTextField: "text", dataValueField: "REPORTID", dataSource: data, index: 0 }); $("#p_sel_population").kendoDropDownList({ cascadeFrom: "p_report_type", optionLabel: "Select Population...", dataTextField: "POPNAME", dataValueField: "POPID", dataSource: { serverFiltering: true, transport: { read: "pykirxb_payr_ln.p_json_read_pop" } } }); });</script> </div>
There are 3 DropDownList. DropDownList p_year and p_sel_population is using JSON. DropDownList p_report_type is using static value.
Attached please find the p_year.json result file (i.e. pykirxb_payr_ln.p_json_read_year ) and p_sel_population.json result file (i.e. pykirxb_payr_ln.p_json_read_pop). I have validated the JSON content and they are correct.
Now. DropDownList P_YEAR and P_REPORT_TYPE work properly. However, the Cascading DropDownList P_SEL_POPULATION does not work. I guess it cannot retrieve the corresponding JSON content.
Any idea to solve it?
Thanks!