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

Revert Multiselect to original state?

1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
chris asked on 01 Nov 2013, 10:47 PM
I have a multiselect widget that gets its initial values from my model and then reads from a datasource to get options.  What i'd like to do provide users a button they can click to revert all changes made to the multiselect. 

My Multiselect definition is below:
         .Placeholder("Edit EMR maps...")
             ds => ds.Read(r=>r.Action("ReadMapOptions","EmrMappingKendo", new {Area="Messaging"})).ServerFiltering(true))
         .Events(e =>
On the databound I invoke a function where i copy the existing value and _dataItems array into new arrays (this way i have what the original state of the widget was).  Then in my function that is invoked by my cancel button i try to set the .value and .dataItem properties of the multiselect and refrech them but the UI doesn't update.  Can someone see my flaw?

 //function invoked by dataBound   
function saveInitialMultiValues(multi) {
        multi.sender._originaldataItems = multi.sender._dataItems.slice(0);
        multi.sender._originalValues = multi.sender._values.slice(0);
//function invoked by my cancel button
function cancelMultiSelectUpdates(multiId) {
     var multi = $('#' + multiId);
     var temp ="kendoMultiSelect");
     temp._dataItems = temp._originaldataItems;
     temp._values = temp._originalValues;
Ive debugged it and my array values are copied to my placeholder arrays and then back into the _values and _dataItems array properly but the UI doesn't reflect the change....

1 Answer, 1 is accepted

Sort by
Georgi Krustev
Telerik team
answered on 05 Nov 2013, 09:00 AM
Hello Chris,

I will suggest you use the API of the widget. The value in this case can be used to set/clear the selected data of the widget.

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