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

Reload DataSource when using X-Everlive-Filter

1 Answer 48 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Randy
Top achievements
Rank 1
Randy asked on 24 Jan 2017, 01:16 PM

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,
        });

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 26 Jan 2017, 10:34 AM

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 and is part of the Telerik Platform.
 
Tags
General Discussion
Asked by
Randy
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or