Announcement

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

    ListGrid with setDeferRemoval and saveAllEdits exception

    Hi,

    I've encountered an bug when using ListGrid:setDeferRemoval(). The standalone test case below produces the error in both IE8 and FF17.

    Steps to reproduce: Remove Canada. Remove USA. Click Save.
    Interestingly, if USA is removed first and then Canada, the save is fine. Also, if only one row is removed the save is fine as well.

    I'm using SmartClient Version: v8.3p_2013-02-15/LGPL Development Only (built 2013-02-15).

    Developer console stack trace:
    Code:
    08:53:39.981:MUP0:INFO:gridEdit:isc_ListGrid_0:Saving newValues 'null'
    08:53:40.074:MUP0:WARN:Log:Error:
    	''undefined' is null or not an object'
    	in http://127.0.0.1:8888/bsa_gwt_webapp/sc/modules/ISC_Grids.js
    	at line 1672
        ListGrid.$336(_1=>Obj, _2=>"this.$335('',rowNum,0,colNum,editComplet..."[57])
        ListGrid.saveEditedValues(_1=>1, _2=>-1, _3=>Obj, _4=>undef, _5=>undef, _6=>"programmatic", _7=>"this.$335('',rowNum,0,colNum,editComplet..."[57])
        ListGrid.saveEdits(_1=>"programmatic", _2=>"this.$335('',rowNum,0,colNum,editComplet..."[57], _3=>1, _4=>-1, _5=>false, _6=>true)
        ListGrid.saveAllEdits(_1=>undef, _2=>undef)
        StatefulCanvas.handleActivate(_1=>Obj, _2=>undef)
        StatefulCanvas.handleClick(_1=>Obj, _2=>undef)
        [c]EventHandler.bubbleEvent(_1=>[IButton ID:isc_IButton_0], _2=>"click", _3=>undef, _4=>undef)
        [c]EventHandler.handleClick(_1=>[IButton ID:isc_IButton_0], _2=>undef)
    [c]EventHandler.$k5(_1=>Obj{type:error}, _2=>undef)
        [c]EventHandler.handleMouseUp(_1=>Obj{type:error}, _2=>undef)
        [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseUp(), _2=>Obj{type:error})
        anonymous(event=>undef)
            "if (!isc.Browser.isIE && event == null) return;var returnVal=arguments.callee.$ch.isc.EH.dispatch(arguments.callee.$j2,event);return returnVal;"
    Code:
    public void onModuleLoad() {
            VLayout layout = new VLayout(10);
    
    	final ListGrid listGrid = new ListGrid();
    	listGrid.setWidth(200); 
    	listGrid.setHeight(100);
    	listGrid.setCanRemoveRecords(true);
    	listGrid.setDeferRemoval(true);
    
    	ListGridField countryField = new ListGridField("country", "Country");
    
    	listGrid.setFields(countryField);
    
    	ListGridRecord rec1 = new ListGridRecord();
    	rec1.setAttribute("country", "Canada");
    
    	ListGridRecord rec2 = new ListGridRecord();
    	rec2.setAttribute("country", "USA");
    
    	listGrid.setRecords(new ListGridRecord[] {rec1, rec2});
    
    	layout.addMember(listGrid);
    
    	IButton saveButton = new IButton("Save");   
    	saveButton.addClickHandler(new ClickHandler() { 
    		public void onClick(ClickEvent event) {   
    			listGrid.saveAllEdits();
    		}  
    	});   
    
    	layout.addMember(saveButton);
    	layout.draw();
    }
    Thanks

    #2
    This has been fixed. Note, it happens only when not using a DataSource.

    Comment


      #3
      I've confirmed this has been fixed with the 2013-02-19 nightly. Thanks. I've encountered a potentially related bug.

      Steps to reproduce: Click Add New. Click to remove the row. Click Save.

      Developer console stack trace:
      Code:
      11:22:02.873:MUP5:INFO:gridEdit:isc_ListGrid_0:Saving newValues 'null'
      11:22:02.920:MUP5:WARN:Log:Error:
      	''undefined' is null or not an object'
      	in http://127.0.0.1:8888/bsa_gwt_webapp/sc/modules/ISC_Grids.js
      	at line 1675
          ListGrid.$336(_1=>Obj, _2=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59])
          ListGrid.saveEditedValues(_1=>0, _2=>-1, _3=>Obj, _4=>undef, _5=>undef, _6=>"programmatic", _7=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59])
          ListGrid.saveEdits(_1=>"programmatic", _2=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59], _3=>0, _4=>-1, _5=>false, _6=>true)
          ListGrid.saveAllEdits(_1=>undef, _2=>undef)
          StatefulCanvas.handleActivate(_1=>Obj, _2=>undef)
          StatefulCanvas.handleClick(_1=>Obj, _2=>undef)
          [c]EventHandler.bubbleEvent(_1=>[IButton ID:isc_IButton_0], _2=>"click", _3=>undef, _4=>undef)
          [c]EventHandler.handleClick(_1=>[IButton ID:isc_IButton_0], _2=>undef)
          [c]EventHandler.$k5(_1=>Obj{type:error}, _2=>undef)
          [c]EventHandler.handleMouseUp(_1=>Obj{type:error}, _2=>undef)
          [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseUp(), _2=>Obj{type:error})
          anonymous(event=>undef)
              "if (!isc.Browser.isIE && event == null) return;var returnVal=arguments.callee.$ch.isc.EH.dispatch(arguments.callee.$j2,event);return returnVal;"
      Code:
      public void onModuleLoad() {
      	VLayout layout = new VLayout(10);
      
      	final ListGrid listGrid = new ListGrid();
      	listGrid.setWidth(200); 
      	listGrid.setHeight(100);
      	listGrid.setAutoSaveEdits(false);
      	listGrid.setCanRemoveRecords(true);
      	listGrid.setDeferRemoval(true);
      
      	ListGridField countryField = new ListGridField("country", "Country");
      
      	listGrid.setFields(countryField);
      
      	layout.addMember(listGrid);
      
      	IButton saveButton = new IButton("Save");   
      	saveButton.addClickHandler(new ClickHandler() { 
      		public void onClick(ClickEvent event) {   
      			listGrid.saveAllEdits();
      		}  
      	});   
      
      	IButton addButton = new IButton("Add New");
      	addButton.addClickHandler(new ClickHandler() {
      		public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
      			listGrid.startEditingNew();
      		}
      	});
      
      	layout.addMember(addButton);
      	layout.addMember(saveButton);
      	layout.draw();
      }
      Thanks

      Comment


        #4
        This should now be resolved as well. Please try the next nightly build dated Feb 22 or above.

        Thanks
        Isomorphic Software

        Comment


          #5
          I've retried with v8.3p_2013-02-23/LGPL Development Only (built 2013-02-23). The same code and same steps as my previous post still produce an exception although one that is slightly different than previously.

          Code:
          11:26:48.921:MUP6:INFO:gridEdit:isc_ListGrid_0:Saving newValues 'null'
          11:26:49.015:MUP6:WARN:Log:Error:
          	''undefined' is null or not an object'
          	in http://127.0.0.1:8888/bsa_gwt_webapp/sc/modules/ISC_Grids.js
          	at line 1676
              ListGrid.$336(_1=>Obj, _2=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59])
              ListGrid.saveEditedValues(_1=>0, _2=>-1, _3=>Obj, _4=>undef, _5=>undef, _6=>"programmatic", _7=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59])
              ListGrid.saveEdits(_1=>"programmatic", _2=>"this.$335('_0',rowNum,0,colNum,editCompl..."[59], _3=>0, _4=>-1, _5=>false, _6=>true)
              ListGrid.saveAllEdits(_1=>undef, _2=>undef)
              StatefulCanvas.handleActivate(_1=>Obj, _2=>undef)
              StatefulCanvas.handleClick(_1=>Obj, _2=>undef)
              [c]EventHandler.bubbleEvent(_1=>[IButton ID:isc_IButton_0], _2=>"click", _3=>undef, _4=>undef)
              [c]EventHandler.handleClick(_1=>[IButton ID:isc_IButton_0], _2=>undef)
              [c]EventHandler.$k5(_1=>Obj{type:error}, _2=>undef)
              [c]EventHandler.handleMouseUp(_1=>Obj{type:error}, _2=>undef)
              [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseUp(), _2=>Obj{type:error})
              anonymous(event=>undef)
                  "if (!isc.Browser.isIE && event == null) return;var returnVal=arguments.callee.$ch.isc.EH.dispatch(arguments.callee.$j2,event);return returnVal;"
          Thanks.

          Comment


            #6
            You're correct there was an additional case to consider that could lead to this error - this is now fixed for tomorrow's 3.1 and 4.0 builds.

            Comment


              #7
              Tested and confirmed fixed with the 3.1p 2013-02-25 build. Thanks very much for resolving these bugs so quickly.

              Comment

              Working...
              X