Reload DataSource when using X-Everlive-Filter

Thread is closed for posting
2 posts, 0 answers
  1. Randy
    Randy avatar
    11 posts
    Member since:
    Dec 2015

    Posted 24 Jan 2017 Link to this post

    We have a hybrid app that uses Kendo UI datasource with backend services. We have used custom filtering to filter the datasource.

    The code below works great to provide the data we need, but the data changes during a user session. How can we best reload the data? With other views we use data-reload="true", but we don't use custom filtering with those views/datasources. data-reload="true" doesn't seem to work with this datasource.

     

    var filterExpression = {
                "Username": { "$in": friendListArray }
            };

     var friendsDataSource = new kendo.data.DataSource({
                type: 'everlive',
                schema: {
                    model: allUsersModel
                },
                transport: {
                    typeName: 'Users',
                    read: {
                        headers: {  
                            "X-Everlive-Fields": JSON.stringify(fieldsExp),
                            "X-Everlive-Filter": JSON.stringify(filterExpression)
                        },                    
                    }
                },
                serverFiltering: true,
            });
  2. Martin
    Admin
    Martin avatar
    104 posts

    Posted 26 Jan 2017 Link to this post

    Hi Randy,

    The data-reload causes the remote view to be read again from the file and rendered again. With disabled reload, the view content is loaded just once and it remains in the page HTML.

    I would suggest not to use data-reload but to use the show event of the view that you are loading to trigger the logic that updates the data in the view. To update the data you may call dataSource.read(); in the show event and set the autoBind configuration option of the widget to "false" in order not to trigger the execution of dataSource.read() twice. This way the view itself would not be rendered again but data would be updated.

    Let me know if this has helped.

    Regards,
    Martin
    Telerik by Progress
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top