DataSource external filter

3 posts, 1 answers
  1. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 06 Sep 2016 Link to this post


    I'm trying to reuse the same data from the datasource in on 3 different places on the webpage without recalling the web api.

    I'm trying to get this piece of code to work, but without success.
    Anyone sees what i'm doing wrong here?


    I'm trying to add a filter where i a column should equal a value.

    var dataSource = new{
        transport: {
            read: {
                url: "/api/articles/getProductSpecifications",
                dataType: "json"
    var filters = dataSource.filter().filters;
    var new_filter = { field: "groupId", operator: "eq", value: 0 };
        dataSource: dataSource.filter(filters),
        template: kendo.template($("#template").html())

  2. Answer
    Dimiter Topalov
    Dimiter Topalov avatar
    628 posts

    Posted 07 Sep 2016 Link to this post

    Hello David,

    The dataSource.filter() method returns undefined, when used as a setter. The dataSource.filter configuration option should be used instead to initially filter a given dataSource.

    Please mind that using the same dataSource instance for several dataBound widgets is not recommended, as data operations over the dataSource will be reflected in all widgets, even if  they are made after the widgets have been initialized e.g.:

    The suggested approach is to use a separate dataSource instance for each widget, and provide a different filter configuration as necessary, or to store all data items from the initial, unfiltered dataSource, in an array, and then create as many different subsets of items, as necessary, via filtering this array with JavaScript (e.g. the Array.prototype.filter() method), and pass the resulting arrays as a dataSource for the respective different ListViews.

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. David Blok
    David Blok avatar
    42 posts
    Member since:
    Nov 2009

    Posted 08 Sep 2016 in reply to Dimiter Topalov Link to this post

    Hi, Thanks for the advice.

    I'll setup seperate datasources for each widget.

    My idea was to only call the API once, instead of multiple times.

Back to Top