Announcement

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

    _jsOverrideCall in ListGrid.getTotalRows on a DateChooser

    Hi,

    I'm hitting this JS error suddenly.
    When I compare the 4.0 ListGrid source of that method with the source of https://code.google.com/p/smartgwt/s.../ListGrid.java it seems this method has been changed.


    Code:
    com.google.gwt.core.client.JavaScriptException: (TypeError) : self_0._jsOverrideCall is undefined
    Unknown.$getTotalRows(ListGrid.java:13825)
    
    
        public native int getTotalRows() /*-{
            var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
            if (self._jsOverrideCall.getTotalRows) {
    	        self._fireDefaultMethod.getTotalRows = true;
    	        return 0;
    	    }
            var ret = self.__getTotalRows();
            if (!$wnd.isc.isA.Number(ret)) ret = 0;
            return ret;
        }-*/;
    My code is some loop which does some checks on all ListGrids, and I have an embedded com.smartgwt.client.widgets.DateChooser, which seems to be a ListGrid as well, which is giving this exception, as the ID of the Canvas which is going wrong is "isc_DateChooser_0_dateGrid".

    There is some more code in ListGrid using this _jsOverrideCall property. Is it something we should fix?

    SmartGWT 4 v9.0p_2013-07-17/Pro Deployment (built 2013-07-17)



    TIA
    Last edited by levi; 22 Jul 2013, 01:15.

    #2
    Can you show us how you're reproducing this JS error?
    The code you show should be correct - it's set up in a way that allows methods overridden in Java to be correctly invoked from native framework calls originated within JS, and we haven't seen a problem like this with it.

    If you can show us a snippet of code we can run on our end which demonstrates the problem we'll get you a resolution as soon as we can.

    Thanks
    Isomorphic Software

    Comment


      #3
      Here's a repro. Click the button for the JS exception.
      We recursively check all ListGrids for errors on a layout's members, including then the DateChooser's data grid.

      Code:
      final DateChooser dateChooser = new DateChooser();
      dateChooser.setAlign(Alignment.CENTER);
      dateChooser.setFirstDayOfWeek(1);
      
      ListGrid grid = new ListGrid();
      grid.setLeaveHeaderMenuButtonSpace(true);
      ListGridField field1 = new ListGridField("field1", "This is some title");
      ListGridField field2 = new ListGridField("field2", "This is also a wide title");
      grid.setFields(field1, field2);
      
      final HLayout layout = new HLayout();
      layout.setWidth100();
      layout.setHeight(600);
      
      Button validChecker = new Button("Valid?");
      validChecker.addClickHandler(new ClickHandler() {
      	
      	private void memberChecker(Canvas parent) {
      		Canvas [] cvs;
      		if (parent instanceof Layout){
      			cvs = ((Layout) parent).getMembers();
      		} else {
      			cvs = parent.getChildren();
      		}
      		
      		
      		for (Canvas c : cvs) {
      			if (c instanceof ListGrid) {
      				ListGrid grid = (ListGrid)c;
      				SC.logWarn("Checking grid '"+grid.getID()+"'");
      				
      				String groupState = grid.isGrouped()?grid.getGroupState():null;
      				if (groupState != null) grid.ungroup();
      				
      				int totalRows = grid.getTotalRows();
      				for (int i=0;i<totalRows;i++) {
      					grid.clearRowErrors(i);
      				}
      				if (groupState != null) grid.setGroupState(groupState);
      			} else {
      				memberChecker(c);
      			}
      		}
      		
      	}
      	
      	@Override
      	public void onClick(ClickEvent event) {
      		memberChecker(layout);
      	}
      });
      
      layout.setMembers(dateChooser, grid, validChecker);

      Comment


        #4
        You should see a fix to this in tonight's mainline (4.1d) and 4.0p builds.

        Comment

        Working...
        X