cascadeFromField does not work

5 posts, 0 answers
  1. Alex
    Alex avatar
    2 posts
    Member since:
    Aug 2012

    Posted 12 Sep 2014 Link to this post

    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?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 16 Sep 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Kiandy
    Kiandy avatar
    2 posts
    Member since:
    Nov 2010

    Posted 23 Mar 2015 Link to this post

    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"}]

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 24 Mar 2015 Link to this post

    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!
     
  6. Kiandy
    Kiandy avatar
    2 posts
    Member since:
    Nov 2010

    Posted 24 Mar 2015 in reply to Georgi Krustev Link to this post

    Hi Georgi,

    Thanks very much and it works now :) 
Back to Top
Kendo UI is VS 2017 Ready