kendo duplicate rendering issue

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

    Posted 21 Jun 2013 Link to this post

    a long time ago we modified the kendostore front sample for our internal needs.

    specifically store-browse.js

    (function ($, kendo, store) {
        var viewModel = kendo.observable({
            Products: {
                data: [],
                total: 0
            },

    noticed data is array not DataSource or ObservableArray
     - changing to DataSource throws a recursion error in kendo js file
     - ObservableArray works but suffers from duplicate rendering issue


    About: kendo duplicate rendering issue

    <section>
        <div class="clearfix" data-role="listView" data-bind="source: Products.data" data-template="product-template"></div>
    </section>

    attached is image where left side is code causes duplicate rendering randomly.

    my hack so i wouldn't have to do major refactoring is on the right . (working - no more doubles)


    Can someone explain why doubles happen when pushing into array (left side of code)?
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 25 Jun 2013 Link to this post

    Hi leblanc,

    ViewModel.products.data is an ObservableArray (it will be internally transformed by the MVVM when ViewModel is created). There should be no need to manually set the Products.data, the array should trigger its change event as soon as you push something inside it.

    I am afraid that the provided information is not sufficient enough in order to determine where exactly the problem comes from. Please remove "viewModel.set("Products.data", ....)" and let me know if the issue still persists.

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top