Announcement

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

    Disappearing error rows in ListGrid (4.1p)

    We recently encountered a problem in SmartClient Version: v9.1p_2014-04-29/Pro Deployment (built 2014-04-29) where new ListGrid rows with validation errors disappear from the grid. Tested in Firefox 26.0 and Chrome 35.0.1916.153

    I found this post that describes the symptoms we were seeing and a suggested workaround until a fix is available.

    As the post suggested I attempted to override public int getRowHeight() but since the problem only affects hosted mode, I attempted to use a hook that applies just to hosted mode, and defers to the framework code in other cases so as to avoid affecting 'working' code... or so I thought.
    Code:
    @Override
    public int getRowHeight(ListGridRecord record, int rowNum) {
                    
        if ( !GWT.isScript() ) {
            return getCellHeight();
        }       
        
        return super.getRowHeight(record, rowNum);
    }
    however in fixing hosted mode, it causes script mode to break.

    If I take the hook away, and return getCellHeight() regardless of the 'mode', it works.
    Code:
    @Override
    public int getRowHeight(ListGridRecord record, int rowNum) {
            return getCellHeight();
    }
    If I have no overridden method, only script mode works.

    I understand the fix in the thread did not specify to test for script/non-script, but can you explain why this doesn't work?

    It's taken me several hours to figure out that this is actually causing a problem so I'm naturally eager to understand why.

    I would expect the framework to be deferring to the superclass getRowHeight() method if I didn't have the override method in the code, so why doesn't it work when I put the hook in?

    This simple demo class shows the problem:
    Code:
    public class Test implements EntryPoint {
    
        /**
         * {@inheritDoc}
         */
        @Override
        public void onModuleLoad() {
            
            SC.showConsole();
            SC.say("Is script? " + GWT.isScript() );
            final ListGrid grid = new ListGrid()
            {
                
                @Override
                public int getRowHeight(ListGridRecord record, int rowNum) {
                    
                    if ( !GWT.isScript() ) {
                        return getCellHeight();
                    }
                    
                    return super.getRowHeight(record, rowNum);
                }
            };
    
            ListGridField id = new ListGridField("identifier");
            ListGridField description = new ListGridField("description");
            description.setRequired(true);
            
            grid.setFields(id, description);
            
            grid.setWidth100();
            grid.setHeight100();
            
            IButton button = new IButton("click");
            button.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
                    grid.startEditingNew();
                }
            });
            VLayout canvas = new VLayout();
            canvas.addMember(grid);
            canvas.addMember(button);
            canvas.show();
        }
    }
    I've checked builds up to 2014-06-30 but the hosted mode problem persists.

    Can you indicate why functionality differs between hosted mode and script mode in this instance? And when a permanent fix will be made available?
    Thanks.

    #2
    We have a developer assigned to take a look at this. We'll follow up when we have more information for you.

    Regards
    Isomorphic Software

    Comment


      #3
      Just a quick follow up to let you know this is not forgotten!
      We anticipate a fix for the underlying issue soon, in the meantime the workaround of always returning the result of getCellHeight() should work for you.

      As an aside the seeming inconsistencies you've seen with the issue only manifesting in development mode, or in compiled mode if your override which calls "super" is in place are all related to a SmartGWT implementation detail - not in this case a fundamental difference between hosted and compiled mode in GWT - and will go away when we have the underlying issue resolved

      Regards
      Isomorphic Software

      Comment


        #4
        This has now been addressed in 4.1 and 5.0 - as of today's build, you can get rid of your getRowHeight() override and it should work as expected, in script mode and otherwise.

        Comment

        Working...
        X