1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    3
    Vote Rating
    0
    lieuweprins is on a distinguished road

      0  

    Default Unanswered: Odd: record.set causes unwanted redraw of every list item.

    Unanswered: Odd: record.set causes unwanted redraw of every list item.


    I have a dataview, linked to a store. the dataview has an itemTpl which uses one of the fields of the model to give each element a background image.

    When I use record.set on the name field of one record, the element in the dataview nicely updates; it alters the name in the template of that single item.

    Now, I decided to use a List rather than a dataview, because I wanted groups, and because of some interesting features such as "infinite" and "useSimpleItems" I wanted to try out for performance reasons. I assumed not much would change, but alas.

    For some reason, a simple record.set("someunrelatedfield", "kittens") on one record of my store forces the template of every item in the list to redraw. I have a function with a console.log in my template. Doing a simple record.set causes 300 console.logs, one for each row in my list. Now, this is a problem, because this causes 300 image requests each time. And it looks silly. And it is almost always unnecesary, except for the one item to which the record.set applies... :U

    My itemTpl:

    HTML Code:
    <div id="ss-item-{ProductPk}" style="background-image:url('http://someserver/resource/{ProductPk}');">{ProductName}</div>
    My code to create a store and fill it:

    Code:
    
    
    Ext.create('Ext.data.Store', {
        model: 'MyApp.model.OrderModel',
        storeId: "SelfServiceStore"
    });
    
    
    var newstore=Ext.getStore("SelfServiceStore");
    
    
    Ext.getStore("ProductsStore").each(function(record){
        newstore.add({ "Price" : record.get("Price"), "ProductNumber" : record.get("ProductNumber"), "ProductName" : record.get("ProductName"), "GroupName" : record.get("GroupName"), "ProductPk" : record.get("Pk"), "NumberOfProducts" : 0});
    });
    
    
    this.getMyAwesomeList().setStore(newstore);
    The code that triggers an entire list redraw every time I run it:

    Code:
    
    var record = Ext.getStore("SelfServiceStore").getAt(Ext.getStore("SelfServiceStore").find("ProductPk", 225));
    record.set("NumberOfProducts",record.get("NumberOfProducts") + 1);
    Am I doing something wrong? Is this intended behaviour? I would assume not, because the dataview seems to handle updating a single record by updating only the template of the related dataview item in question.

    I searched around for a whole day, but wasn't able to find anyone with list refresh issues with unwanted refreshes, so I figure my best bet is to ask.

    I'm using sencha touch 2.2.0.

  2. #2
    Sencha User
    Join Date
    Aug 2012
    Posts
    3
    Vote Rating
    0
    lieuweprins is on a distinguished road

      0  

    Default


    I semi solved this as follows:

    On my store , I would run this:
    Ext.getStore("SelfServiceStore").suspendEvents(false);
    so that my list no longer got updated automatically. Had to do it manually instead. And then I ran into other problems, but I figured the "solution" might help someone.

  3. #3
    Sencha User Diego Garcia's Avatar
    Join Date
    Jan 2012
    Location
    San José, Costa Rica.
    Posts
    81
    Answers
    13
    Vote Rating
    7
    Diego Garcia is on a distinguished road

      0  

    Default


    Any clue on this?? I'm having the same issue.
    This does't make any sense at all.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar