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

Template update only first time

1 Answer 45 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Petr
Top achievements
Rank 1
Petr asked on 04 Nov 2013, 06:59 PM
Hi,
template for collection update only for first push.
Click add button and only first time template rerender.
http://jsfiddle.net/gDVwS/1/

Thank

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 06 Nov 2013, 12:51 PM
Hello Petr,

In order to fix this issue you should reference the data directly:
activeData: function(){
    var result;
    $.each(this.data, function(index, item){
        if (item.active == true) {
            result = item;
            return false;
        }
    });
     
    return result;
}

Here is a link to the updated jsFiddle:
On a side note, using jQuery.each in this case might affect onto the performance. My recommendation is to either use a standard for loop or jQuery map method which is faster.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Templates
Asked by
Petr
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or