Announcement

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

    ListGrid scrollToColumn and hilites not working

    1.SmartClient Version: v8.3p_2013-01-29/Pro Deployment (built 2013-01-29)
    2.IE 8, Firefox

    I have a grid built like this:
    Code:
    ListGrid grid = new ListGrid();
                    grid.setFields(fields.toArray(new ListGridField[0]));
                    grid.setData(records.toArray(new RevenueForecastorGridRecord[0]));
                    grid.setWidth(1200);
                    grid.setHeight(300);
                    grid.setUseAllDataSourceFields(Boolean.TRUE);
                    grid.setLoadingDataMessage("Loading Report...");
                    grid.setAutoFetchData(false);
                    grid.setSelectionType(SelectionStyle.SINGLE);
                    grid.setAutoFitData(Autofit.VERTICAL);
                    grid.setAutoFitMaxRecords(15);
                    grid.setAutoFitFieldWidths(true);
                    grid.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
                    grid.setAlternateRecordStyles(true);
                    grid.setEditEvent(ListGridEditEvent.CLICK);
                    grid.setLeaveScrollbarGap(false);
                    grid.setAutoSaveEdits(false);
                    grid.setCanEdit(true);
                    grid.setEditByCell(true);
                    grid.setGroupStartOpen(GroupStartOpen.ALL);
                    grid.setGroupByField("bedroomcount");
                    grid.setSortField("bedroomcount");
                    grid.setSortDirection(SortDirection.ASCENDING);
                    grid.scrollToColumn(scrollColumnIndex);
                    // set hilite fields
    
                    final List<String> hiliteFieldNames = new ArrayList<String>();
                    for (ListGridField field : fields.subList(0, scrollColumnIndex)) {
                        hiliteFieldNames.add(field.getName());
                    }
                    Hilite[] hilites = new Hilite[] { new Hilite() {
                        {
                            // setFieldNames(hiliteFieldNames.toArray(new String[0]));
                            setBackgroundColor("#FF00FF");
                            setCssText("background-color:#FF00FF");
                            setId("0");
                        }
                    } };
                    grid.setHilites(hilites);
                    grid.setHiliteProperty("0");
    
                    panel.removeMembers(panel.getMembers());
                    panel.addMember(grid);
                    panel.redraw();
    Neither the scrollToColumn nor the column hilites work. Also in the dev hosted mode I see a bunch of the following warnings listed.

    Code:
    09:48:35.253 [ERROR] [revenueforecastor] 09:48:35.267:XRP4[E]:WARN:ListGrid:isc_ListGrid_3:getCellRecord called with bad rowNum: null
    com.smartgwt.client.core.JsObject$SGWT_WARN: 09:48:35.267:XRP4[E]:WARN:ListGrid:isc_ListGrid_3:getCellRecord called with bad rowNum: null
        at sun.reflect.GeneratedConstructorAccessor20.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Unknown Source)
    These warnings do not show up when I comment out the scrollToColumn() setting on the grid.Not sure how to get around this issue.

    #2
    scrollToColumn() can't work while the grid is not yet drawn and doesn't have data (the empty message is showing). Try scrolling when the DataArrived event fires.

    Comment


      #3
      I added a data arrived handler and set the grid.scrollToColumn and hilites within it but that doesnt work either. In fact I dont even see the handler getting called ( didnt hit a breakpoint in hosted mode).
      Would the dataArrivedEvent fire when the grid is not based on a datasource and I set the data on the grid directly through the grid.setData(recordArray) method?
      BTW, the warnings obviously dont appear now after I moved the grid.scrollToColumn into the dataArrivedHandler callback.
      Last edited by aarathi; 14 Mar 2013, 19:13.

      Comment


        #4
        No DataArrived does not fire if data does not "arrive" over a network.

        In this case, just move scrollToColumn() to a DrawHandler.

        Comment

        Working...
        X