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

How to "clear" a DataSource used in MVVM

4 Answers 1326 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Luc
Top achievements
Rank 1
Luc asked on 18 Apr 2012, 02:40 AM
Hi,

What is the recommended way to "clear" a DataSource used in an MVVM scenario ?

For example, if I bind a ListView to a DataSource wrapped inside an ObservableObject, what is the recommended way to clear all the items ?

Thanks

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 18 Apr 2012, 03:18 PM
Hello Luc,

 
You can try the DataSource's data method and pass an empty array as a value.

Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Luc
Top achievements
Rank 1
answered on 18 Apr 2012, 04:16 PM
Hi Georgi,

Unfortunately, I had already tried that, and though I can see in the code that the data is now an empty array, the view is not refreshed as one would expect.

My experience with other binding framework is that setting to null clears the HTML elements as well.

Is there a way to force the elements to refresh themselves ?

Thanks
0
Georgi Krustev
Telerik team
answered on 20 Apr 2012, 12:49 PM
Hello Luc,

 
I will ask you to open a support thread for this issue and share your current implementation. Thus we will be able to observe the issue locally and advice you further.

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Luc
Top achievements
Rank 1
answered on 20 Apr 2012, 08:35 PM
Georgi,

I have traced the problem to be with a 3rd party library.

Sorry, it was my mistake.
Tags
Data Source
Asked by
Luc
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Luc
Top achievements
Rank 1
Share this question
or