Revert Multiselect to original state?

2 posts, 0 answers
  1. chris
    chris avatar
    19 posts
    Member since:
    Jan 2013

    Posted 01 Nov 2013 Link to this post

    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....
  2. Georgi Krustev
    Georgi Krustev avatar
    3688 posts

    Posted 05 Nov 2013 Link to this post

    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!
  3. UI for ASP.NET AJAX banner
Back to Top