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

DataSource MVVM Filter Remove Errors

2 Answers 87 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
ISEEUGlobal
Top achievements
Rank 1
ISEEUGlobal asked on 06 Aug 2015, 01:09 AM

The title for this issue is difficult to describe. Basically here is what we are doing.

1. Using MVVM to bind two search boxes that filter data in a kendo.data.DataSource. The filtering is by setting simple filters on the data source

2. The dataSource is bound to a table (not grid)

3. Each row contains a remove button

With no filters in place the remove operation works correctly. However with any filter applied I can only remove the first item in the list. However it is actually removing the first item in the datasource regardless of the filters, any other items cause an error 'Cannot read property 'kendoBindingTarget' of undefined'. Its hard to understand but if you checkout this jsfiddle

http://jsfiddle.net/habk2b5p/7/

 I have simulated a very cut down‚Äč version of the trial. Basically to use try filter by one or both of the options. (Min 3 characters before filter), once filtered try and remove items. Place close attention to the 'Id' column that you remove as you will see that it actually wont remove the item you selected unless the item selected is id 1 (the first item in the data source).

Any help would be greatly appreciated.

2 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 10 Aug 2015, 07:44 AM
Hello,

It seems that the binder cannot find the correct HTML element which should be removed, as it relies on the index of the underlying data item. When filter is applied however, the index of the data item no longer corresponds to the HTML element, hence the error. I have logged this issue in our GitHub repository, so you can track its status. Meanwhile, you can use a Grid as a workaround.

As a small sign of our appreciation for bringing this to our attention I have updated your Telerik points.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
ISEEUGlobal
Top achievements
Rank 1
answered on 13 Aug 2015, 07:35 AM

Alexander,

 Thank you for reviewing this, I have been forced down the route to reload the data source through an Ajax Request for the filtering. Obviously if I have the data already loaded on the client it is a waste of resources to refetch the same data. One thing I did try was manually filtering the data and rebinding the table.

 I appreciate your review and wish it was something I was doing wrong. Thank you again.

Nico

Tags
Data Source
Asked by
ISEEUGlobal
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
ISEEUGlobal
Top achievements
Rank 1
Share this question
or