Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    updateRecordComponent is never called

    Hi,
    I use SmartGWT 2.5 with FF3.6.
    I have a ListGrid that uses
    Code:
    setShowRecordComponents(true);
    setShowRecordComponentsByCell(true);
    I put the data in the grid using
    Code:
    setData(RecordList);
    I overrided both updateRecordComponent and createRecordComponent, but updateRecordComponent is never called.

    I tried to set
    Code:
    setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE);
    but it still never gets called.
    When should it get called?

    Any help would be greatly appreciated.

    #2
    Hi Rottem,

    I am sorry I don't have an answer, but I am having the same exact problem.

    I tried setting setRecordComponentPoolingMode(RecordComponentPoolingMode.RECYCLE) which I believe is default anyway and also tried RecordComponentPoolingMode.VIEWPORT in hopes of destroying the record and forcing createRecordComponent to be called for the destroyed components to force them to be recreated. This did not work.

    There are other workarounds, like using setSort() on one of the columns but that has not worked for me. I also tried setSortField(). Maybe this would work for you?

    There seems to be a lot of questions on the forum about this but no solutions.

    Comment


      #3
      Something wrong with refreshRecordComponent()?

      Comment


        #4
        Thank you very much for your reply.

        Using refreshRecordComponent() does not seem to be forcing updateRecordComponent to be called but it does call createRecordComponent which is good but my problem is I need to call updateRecordComponent when there is any sort of resize to the listgrid.

        I am embedding a progressbar into a cell in the listgrid. The bar is dynamically updating with messaging and when it hits %100 I hide the progress bar.

        when any kind of resizing happens, all finished progress bars reappear. I used handlers to rehide all the progress bars that had completed and it worked great except for column resizing.

        I was using the addFieldStateChangedHandler to rehide but this does not fire until the user has released the mouse button. Therefore, all hidden progress bars reappear while the user holds the mouse down while adjusting the column widths.

        createRecordComponent is called as soon as column resizing begins but skips the cells that already have components in them. Therefore it should also call updateRecordComponent at the same time but it wont. If it did, I could add logic to rehide the progressbars.

        How can updateRecordComponent be called on resizing?

        Thank you!

        Comment


          #5
          I cannot use refreshRecordComponent(int rowNum) because I don't know the row number. I only have the ListGridRecord of the changed record. Is there a way to retrieve the correct row number from the ListGridRecord?

          Comment


            #6
            @rottem you can get the row number by using getRecordIndex()

            @matti refreshRecordComponent will call either createRecordComponent or updateRecordComponent according to the pooling mode and whether record components are available in the pool. If you are just destroy()ing those progress bars, that would explain the effect you're seeing, because that's not valid. Instead, just call refreshRecordComponent, and return null from refreshRecordComponent/createRecordComponent.

            Comment


              #7
              Thanks a lot !

              Comment


                #8
                Thank You that is very helpful. I don't need to worry about the re-sizing if I call with refreshRecordComponent like that.

                The only way to call refreshRecordComponent by the selected row, the problem is that there could be multiple progressbars running at one time and I may not have the row selected which contains the progress bar when it finishes. So, I am iterating through all components every time one finishes and refreshing if the value is 100%.

                Is there an easier way to iterate through all components that are made? Is there a way to re-iterate through all components the same way createRecordComponent iterates through all cells when the grid is loaded(or resized)

                Comment


                  #9
                  The simplest way is most likely to track the recordComponents yourself, but holding on to a list of all components you've ever returned from createRecordComponent().

                  Comment


                    #10
                    Sounds good. This works for me. Thank you very much!

                    Comment


                      #11
                      Originally posted by Isomorphic
                      The simplest way is most likely to track the recordComponents yourself, but holding on to a list of all components you've ever returned from createRecordComponent().
                      Hi, we are still on 2.4, so refreshRecordComponent() available to us. We have the same issue, the updateRecordComponent does not get called. Can you be more specific on "holding on to the recordComponents"? The createRecordComponent() returns a Canvas right, I can hold on to that Canvas instance, but how can I manage to update it (and reflect it in the UI)?

                      Comment


                        #12
                        hi newbieMA

                        I load the components in an array at the createRecordComponent methode and then you can refresh them by iterating through by row/key. refreshRecordComponent will force the call to updateRecordComponent.




                        for ( final String key : grid.componentMap.keySet() ) {
                        final Component component = grid.componentMap.get( key );
                        if ( some condition for refreshing or not ) {
                        refreshRecordComponent(getRecordIndex(key ), columnNumber );
                        }
                        }

                        hope this helps

                        Comment


                          #13
                          Hi, Matti, thanks for your reply. I had a typo in my initial message, I mean we are still on version 2.4, so refreshRecordComponent() is NOT available to us (I believe it's added in 2.5). I was wondering if there's anyway to get around this issue without calling invalidateRecordComponents() all the time.

                          Thanks.

                          Comment

                          Working...
                          X