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

lost selected items after rebind

1 Answer 211 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Matej
Top achievements
Rank 2
Matej asked on 09 Jan 2015, 09:39 AM
Hello,
I extend multiselect functionality with entering free text and after press ";" key i add item to datasource... Everything looks and works fine until i made kendo.bind (after save i reload data and make rebind - simulating this action on checkbox - primitivechanged). When I enter only one item its working fine, but when i enter more than one I lost everything except last item.

Sometimes i get error 'Cannot read property 'style' of undefined' (in kendo.multiselect.js - _select: function...)

Any suggestions on how to make this work?

Thanks

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 Jan 2015, 09:15 AM
Hello Matej,

I've answered to the support thread opened on the same subject. I would like to ask you continue our discussion in only one thread to avoid any duplication. Thank you for your understanding.

Here is a quote of the answer:
In general, adding a new item to the data source is not supported by the widget out-of-the-box and implementing and supporting custom modifications falls out of the scope of the entitled support service. 

Nevertheless, I reviewed the provided demo and the problem comes from the fact that widget is being filtered (the data is reduced) when the form is re-bound. Hence it will select only the last item. This behavior can be overcome with manual filter cleaning in the widget change event handler:

onChange: function(e) {
          if (e.sender.dataSource.filter()) {
            e.sender.dataSource.filter({});
          }
},
The modified file is attached to this message.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
MultiSelect
Asked by
Matej
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or