1. #1
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    55
    Vote Rating
    1
    abhilashca is on a distinguished road

      0  

    Question Confusing and Performance difference between store.add and store.data.add

    Confusing and Performance difference between store.add and store.data.add


    Hello,

    I'm really confused between store.add() and store.data.add() method. I's experiencing performance issue with bulk data insertion in my editorgridpanel. (as mentioned in http://www.sencha.com/forum/showthre...-in-EditorGrid).

    Though the thread, suggets to use suspendEvents and resumeEvent, but doesnt brought any significant performance improvements. As an alternate solution, I used store.data.add() instead of store.add() which gave incredible performance. But, there was some hidden issues in using store.data.add() and as follows:

    I have an editoregridpanel. I duplicated some existing records into the grid, using store.data.add(). Now, if I click on the editable cell of the newly copied record and type-in some values, then on the onblur of that particular cell, the value get restored to its previous value (ie, value before editing). If I click again on the editable-cell, then in the edit-mode of that cell, I can see my original typed-in value and again on the onBlur, it restores its original value.

    To solve this, on cell's afterEdit event, I refreshed the gridview, which solves the above mentioned problem.

    So I conclude that on using store.data.add() method, I'm missing to re-register some events, which is causing the cell's updation problem.

    Here comes my doubt:
    1. What is the difference between store.add and store.data.add?
    2. store.data.add() has a significant performance over store.add(). Why?
    3. Is store.data.add() can be used? If so, what all events I need to re-register and what all events I need to bother about? Do I need to regiter the events for grid, store AND columnmodel?
    4. Why the cell does not detain value when I added records using store.data.add()?

    These are all my finding and concerns.
    Is there any better way to add bulk records into the store without any drop-in-performance?

    Any help will be appreciated.
    Looking forward for valuable responses.
    Thanks.

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,684
    Vote Rating
    112
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    store.data.add is not an official supported method.
    imho there is a lot missing if you just call it and it will have the same speed as store.add if you add all the missing parts manually.

    that being said, i would put all records you want to add into an array and add the array with one add call. if you have to go for multiple calls, suspending the events has an effect.
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2011
    Posts
    55
    Vote Rating
    1
    abhilashca is on a distinguished road

      0  

    Default


    Hello Tobias,

    That was tricky.
    I added all the records into an array and passed to the store object. Now, it has significant performance improvement.

    Thanks.

Thread Participants: 1

Tags for this Thread