In our project, I need to multiply table row. The row which would be copied contains several initialized Kendo UI elements.(AutoComplete, DropDownList,DatePicker.) When I clone row and change ids of its children, but these copied Kendo UI elements don't work. Is there any solution to solve this problem?
            Asked
            
        
        
            Active
            
        
            Viewed 2,379 times
        
    3 Answers
1
            
            
        I had the same query and what I found is that you can make deep copy of the returned JSON object and to assign it where you want after that.
var grid = $("#grid").data('kendoGrid');
// Deep copy
var newGrid = jQuery.extend(true, {}, grid);
I took the idea from - What is the most efficient way to deep clone an object in JavaScript?
 
    
    
        ppenchev
        
- 127
- 1
- 10
0
            
            
        You need to initialise each copied component with original components options by renaming for example
$('.row').find('.k-autocomplete').each(function(){
     var kelement = $(this).data('kendoAutoComplete');
     if(kelement)
     {
         var options = kelement.options;
         $('#copiedelement').kendoAutoComplete(options);
     }
})
 
    
    
        fatih kiymet
        
- 117
- 2
- 11
- 
                    Thanks. This answers gave inspire to me; however the "name" option does not look like related to unique identity of an element. It looks like type of element. ComboBox, AutoComplete, etc. Right? – esquare Jul 13 '15 at 09:33
- 
                    oops sorry my mistake. i edited my answer, name is unique id of element, you must change name of copied element with a different name, thats the trick – fatih kiymet Jul 13 '15 at 10:24
- 
                    as I said before, your answer gave inspire to me. Thanks. I solved this problem using a generic way. Because I have a few Telerik elements in my container which would be copied. I am going to share solve as an answer. – esquare Jul 13 '15 at 10:34
0
            
            
        Yes, after the answer @fatih kiymet advised me, (honestly, it gave inspire to me), I solved the problem using this snippet : http://dojo.telerik.com/@doktoresperanto/EqOHa
 
    
    
        esquare
        
- 3,947
- 10
- 34
- 37