Cloning div containing kendo inputs

后端 未结 1 1552
予麋鹿
予麋鹿 2021-01-25 19:07

I have an application which allows users to dynamically create divs containing kendo inputs. To do so I have a div which contains multiple kendo inputs which I use as a sort of

相关标签:
1条回答
  • 2021-01-25 19:59

    This is almost there: http://dojo.telerik.com/@Stephen/EWEna

    Try cloning just the base inputs of the kendo elements(with a new id) instead of the all the elements that kendo adds. Then get the type and options of the original widget and initialize the new element as the original type with the original options.

    var originalElement = $("#" + originalID);
    var originalWidgetType = "kendo" + kendo.widgetInstance(originalElement).options.name;
    var originalWidget = originalElement.data(originalWidgetType);
    
    element[originalWidgetType](originalWidget.options);
    

    My dojo example is close...but for some reason the cloned DatePickers are too wide...and I haven't tested with all the possible elements but I think it could be used as a start.

    EDIT

    I found this technique using Kendo MVVM that seems like it would be better: http://jsfiddle.net/krustev/U6nSv/

    This is not my solution(not sure how to credit).

    Here is my original example updated to use that technique: http://dojo.telerik.com/@Stephen/aquRE

    0 讨论(0)
提交回复
热议问题