This is a migrated thread and some comments may be shown as answers.

cascadeFromField does not work

4 Answers 461 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 12 Sep 2014, 03:26 PM
I'm using version 2014.1.416

I have two cascading dropdowns with server filtering.  They are working fine, however, I would like the filter value for the child dropdown to use a different property of the parent object then what is set for the dataValueField in the parent dropdown.  So, I tried using cascadeFromField but all that did was change filter[filters][0][field].  It did not change filter[filters][0][value].  To workaround that, I had to set the transport.read.data in the child datasource to the parent property that I actually need.  Is this a bug?

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 16 Sep 2014, 08:23 AM
Hello Alex,

The cascadeFromField option defines the field of the widget data object which will be used for the cascading filtering. In other words, the scope of the cascadeFromField option is the child widget only. If it is not defined, then the widget will look for a field in its data source equal to the parent.dataValueField option. You can find more information about the option in the corresponding API documentation and the adjacent examples.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kiandy
Top achievements
Rank 1
answered on 23 Mar 2015, 05:35 AM
Hi Georgi, 

I try to implement the example above and it seems the cascadeFromField doesn't work with remote data ? Thanks 

Example : 
<select kendo-drop-down-list
        id="regionentity"
        k-data-text-field="'name'"
        k-data-value-field="'id'"
        k-data-source="regiondatasource"
        class="form-control" />
<select kendo-drop-down-list
        k-data-text-field="'name'"
        k-data-value-field="'id'"
        k-data-source="entitiesdatasource"
        k-cascade-from-field="'regionid'"
        k-cascade-from="'regionentity'"
        class="form-control" />

The JS 
$scope.regiondatasource = {
        transport: {
            serverFiltering: true,
            read: {
                url: "http://localhost:62153/api/regions",
            }
        }
    }
 
    $scope.entitiesdatasource = {
        transport: {
            read: {
                url: "http://localhost:62153/api/entities",
            }
        }
    }

Example of API call returned : 
For Entities :
 
[{"id":1,"name":"Company1","region":"Americas","regionID":1},{"id":2,"name":"Company2","region":"Americas","regionID":1},{"id":3,"name":"Company3","region":"ANZ","regionID":3}]
 
For Region :
[{"id":1,"name":"ANZ"},{"id":2,"name":"AMER"},{"id":3,"name":"ASIA"},{"id":4,"name":"EMEA"}]

0
Georgi Krustev
Telerik team
answered on 24 Mar 2015, 10:39 AM
Hello Kiandy,

I believe that the filtering does not work, because widget tries to filter regionid field, but the response has 
regionID fields. I would suggest you change the cascadeFromField option to "regionID".

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Kiandy
Top achievements
Rank 1
answered on 24 Mar 2015, 11:45 PM
Hi Georgi,

Thanks very much and it works now :) 
Tags
DropDownList
Asked by
Alex
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Kiandy
Top achievements
Rank 1
Share this question
or