Changing the input control type in the edit template, but keeping binding.

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    1 posts
    Member since:
    Aug 2010

    Posted 11 Oct 2016 Link to this post

    I've got a Kendo Grid that has an editor template with about 4 fields.  2 of those fields work together in that depending on the first field's value, I need to change the second <input> to be a calendar control, dropdownlist, etc.  This seems to work once if I leave a blank <input> and then in Javascript just do a $(#mycontrol).calendar() or equivalent to flip to a different type.  It seems, though, that there's not a way to easily tell an input to remove the calendar control portion and just go back to a regular input so that it can be changed to another type, without removing it entirely and adding another one, which breaks the binding back to the grid.  Does anyone have a suggestion or pointer for the best way to do this in Kendo?  Thanks!
  2. Dimiter Topalov
    Dimiter Topalov avatar
    1067 posts

    Posted 13 Oct 2016 Link to this post

    Hi Ryan,

    The described scenario is not supported, but a possible workaround is to destroy the widget via its destroy() method, and overcome the broken binding by manually handling the change event of the input, and call the model.set() method to set the input's value to the respective field.

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top