Results 1 to 9 of 9

Thread: Grid Renderer call twice everytime

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    63
    Vote Rating
    0
      0  

    Default Grid Renderer call twice everytime

    HI All, I know this is actually an old bug from the Ext 3

    And it resurfaces again. I store data to a websql database first then web worker upload the data to server in the background.

    So inside the renderer - if some properties change. It will trigger the save method. Then I start to notice a lot of duplicated data (line id same, key same, value exactly the same). Then I put a trap inside the renderer and realize what is going on.

    Everytime the renderer being call - it get call twice. Notice the only custom thing I done is put the saveToMyDatabase code. Everything else is like what everyone would do with Extjs 4.

    Any idea if this is a bug - again? Thanks.
    Last edited by joelchu; 2 Aug 2011 at 8:33 AM. Reason: typo

  2. #2
    Sencha - Engineering Operations mike.estes's Avatar
    Join Date
    Mar 2011
    Location
    Redwood City, CA
    Posts
    221
    Vote Rating
    9
      0  

    Default

    it does sound like a bug, but I am having a hard time trying to reproduce the issue. Do you have a test case handy?

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    63
    Vote Rating
    0
      0  

    Default

    I am taking it apart and step it through at the moment. Report more finding later.

  4. #4
    Sencha User
    Join Date
    Feb 2011
    Posts
    63
    Vote Rating
    0
      0  

    Default

    Try this

    PHP Code:

    grid code 
    ...
    columns: [
    {
    name'adropdown' dataIndex'adropdown' rendererspecialRenderer(combo) , fieldcombo}
    .... 
    so I have create a combo box earlier. Skip that (I think you all know how to create a combobox for the grid right?

    Now the specialRenderer

    PHP Code:
    var specialRenderer = function(combo) {
          return function(
    value params record) {
                    
    console.log('You will see me twice');
          }

    Try the above code. The renderer get call twice everytime.

    I modified the example basic array grid - it get call just once (with a normal renderer not combo renderer). still trying figure out what is triggering the call twice problem.

    Here is a trace of events of the grid

    PHP Code:
    added


    beforerender


    render


    columnresize

    .... (many times )....


    afterlayout

    resize

    columnresize

    columnresize

    afterlayout

    resize

    columnresize

    columnresize

    afterlayout

    resize

    beforestatesave

    statesave

    once
    !

    once!

    once!

    scrollershow

    columnresize

    columnresize

    afterlayout

    resize

    once
    !

    once!

    once!

    once!

    once!

    once!

    beforestatesave

    statesave

    beforecontainermouseover

    containermouseover

    beforecontainermouseout

    containermouseout

    beforecontainermouseover

    containermouseover

    beforecontainermouseout

    containermouseout

    beforecontainermouseover

    containermouseover

    beforecontainermouseout

    containermouseout

    beforecontainermouseover

    containermouseover

    beforecontainermouseout

    containermouseout

    beforecontainermouseover

    containermouseover

    beforecontainermouseout

    containermouseout

    beforeitemmouseenter

    itemmouseenter

    beforeitemmouseleave

    itemmouseleave

    beforeitemmouseenter

    itemmouseenter

    beforeitemmouseleave

    itemmouseleave

    beforeitemmouseenter

    itemmouseenter

    beforeitemmouseleave

    itemmouseleave 
    see the 'once!' that's from insider the render - the first 3 times is correct (there are 3 rows in that grid at that time. Then it gets call 6 times ...

    this is another trace when I edit that cell (a dropdown box)

    PHP Code:
    ....
    validateedit


    once
    !

    select

    edit

    once
    !

    select

    ..... 
    clearly see that has been call twice.
    Last edited by joelchu; 4 Aug 2011 at 7:39 AM. Reason: add more code

  5. #5
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,150
    Vote Rating
    201
      0  

    Default

    Which Ext 4 version is this? I'm guessing this has nothing to do with your renderer. It's simply a slight inefficiency in the grid initialization process which leads to 3 refreshes (as you can see, one is triggered right after the grid has been sized). If you post a complete test case it'd be easy to debug..

  6. #6
    Sencha User
    Join Date
    Feb 2011
    Posts
    63
    Vote Rating
    0
      0  

    Default

    4.02a
    The code is about 3000 lines long ... It's a huge grid and expand depends on the distribution (of goods) so don't think it's possible. But it's pretty standard configuration. I have the same problem back in the v.3 that max out firebugs output when I try to see what's going on (15 rows result in 2500 + output!) I change the way how things save now and not using the rendered as trigger. But still this bug just won't go away ...

  7. #7
    Sencha Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,150
    Vote Rating
    201
      0  

    Default

    Prior to rendering the grid, add a listener for view 'refresh', that should give you an answer.

    Code:
    grid.getView().on('refresh', function() {console.log('refresh'); });

  8. #8
    Sencha User
    Join Date
    Feb 2011
    Posts
    63
    Vote Rating
    0
      0  

    Default

    I know at what point the renderer get call but don't know why it's call. As you can see from the event list. The renderer get call 3 times for e different rows as expected then call 6 more times that means the renderer get call total 3 times each. That I don't understand. I know when the grid get refresh and the renderer will be call. Perhaps it's because of the header resize trigger the refresh ....

  9. #9
    Sencha User
    Join Date
    Mar 2017
    Posts
    11
    Vote Rating
    0
      0  

    Default

    Refer to this link https://forums.ext.net/showthread.ph...n-called-twice it has the answer

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •