Announcement

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

    SmartGWT2.0 AlwaysShowEditors issue

    When I upgraded my application from SmartGWT 1.3 to 2.0, I ran into a JS error with a ListGrid that has setAlwaysShowEditors(true). When I turn off AlwaysShowEditors flag the problem goes away. This is the JS error:
    Code:
    		_4	"Error:
    	''this.$69m' is null or not an object'
    	in http://localhost:8080/mapping-gui/mappingtool/sc/modules/ISC_Grids.js
    	at line 1202
        ListGrid.$69l(_1=>0, _2=>0)
        ListGrid.refreshCell(_1=>0, _2=>0, _3=>undef, _4=>undef)
        ListGrid.$32s(_1=>0, _2=>0, _3=>undef)
        ListGrid.showInlineEditor(_1=>0, _2=>0, _3=>true, _4=>true, _5=>undef)
        ListGrid.$31u(_1=>0, _2=>0, _3=>undef)
        ListGrid.startEditing(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
        ListGrid.dataChanged(_1=>undef, _2=>undef, _3=>undef, _4=>undef)
        dataChangedObservation(operationType=>undef, originalRecord=>undef, rowNum=>undef, updateData=>undef)
        ResultSet.$ee()
        ResultSet.$390(_1=>Array[19], _2=>Obj)
        ResultSet.fetchRemoteDataReply(_1=>Obj, _2=>Array[19], _3=>Obj)
        Class.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>[ResultSet ID:isc_ResultSet_89 (created by: isc_OID_35)], _5=>undef) on [Class Class]
        Class.fireCallback(_1=>Obj, _2=>\"dsResponse,data,dsRequest\", _3=>Array[3], _4=>undef)
        DataSource.$38b(_1=>Array[19], _2=>Obj, _3=>Obj, _4=>undef, _5=>undef)
        DataSource.processResponse(_1=>\"isc_OID_2$6275\", _2=>Obj)
    "	String
    When I debug the JS source where the problem occurs: this.$69m[_3] where _3 is null;

    Code:
    var _7=_3.$316;for(var i=0;i<_4.length;i++){var _8=_4[i],_9=_8.isDrawn(),_10=_7?_7.contains(_8):false,_11=isc.CanvasItem&&isc.isA.CanvasItem(_8);if(_9){if(_10){_8.redrawn();if(_2)_8.moved()}
    else{_8.cleared()}}else if(_10){if(_11)_8.placeCanvas();_8.drawn()}}
    delete _3.$316}
    ,isc.A.$69l=function(_1,_2){if(!this.$286||!this.$686((_2!=null?this.getField(_2):null),true))return;if(_1!=null){var _3="_"+_1+"_"+_2,_4=this.$69m[_3];if(_4){_4.formItem.clearInactiveEditorContext(_4);delete this.$69m[_3]}}else{var _5=this.getEditForm(),_6=_5.getItems();for(var i=0;i<_6.length;i++){_6[i].clearAllInactiveEditorContexts()}
    delete this.$69m}}
    ,isc.A.setRecordValues=function(_1,_2){if(!this.shouldSaveLocally()){this.logWarn("setRecordValues() not supported for grids where saveLocally is false");return}
    if(!this.data)return;var _3=this.data.indexOf(_1),_4=this.data.get(_3);isc.combineObjects(_4,_2);this.calculateRecordSummaries([_4]);if(this.useCellRecords){_3=this.findRowNum(_4);var _5=this.findColNum(_4);this.refreshCell(_3,_5)}else{this.refreshRow(_3)}
    if(this.valuesManager!=null){this.valuesManager.$71e(_3,null,_4,this)}}
    The listgrid is defined as follows:
    Code:
    private ListGrid buildResultsGrid(DataSource resultsDS, final DynamicForm resultsForm) {
    		final ListGrid resultsGrid = new ListGrid();
    		resultsGrid.setAlwaysShowEditors(true);
    		resultsGrid.setHeight(200);
    		resultsGrid.setAlternateRecordStyles(true);
    		resultsGrid.setDataSource(resultsDS);
    		resultsGrid.setAutoFetchData(false);
    
    		ListGridField pickedField = new ListGridField("isPicked", "Pick");
    		pickedField.setType(ListGridFieldType.BOOLEAN);
    		pickedField.setCanEdit(true);
    		ListGridField resultCustomerIdField = new ListGridField("customerId", "Customer ID");
    		resultCustomerIdField.setHidden(true);
    		ListGridField resultsTitleField = new ListGridField("title", "Title");
    		ListGridField creationDateField = new ListGridField("creationDate", "Creation Date");
    		resultsTitleField.setWidth(400);
    		ListGridField resultsManufacturerField = new ListGridField("manufacturer", "Manufacturer");
    		resultsManufacturerField.setWidth(100);
    		ListGridField resultsMfrPartNumberField = new ListGridField("mfrPn", "MfrPn");
    		resultsManufacturerField.setWidth(100);
    		ListGridField categoryField = new ListGridField("category", "Category");
    		categoryField.setWidth(80);
    		ListGridField marketsField = new ListGridField("markets", "Markets");
    		marketsField.setWidth(100);
    		ListGridField upcField = new ListGridField("upc", "UPC");
    		ListGridField productIdField = new ListGridField("productId", "Product ID");
    		productIdField.setHidden(true);
    		ListGridField resultsOutcomeField = new ListGridField("outcome", "Outcome");
    		resultsOutcomeField.setWidth(100);
    		ListGridField scoreField = new ListGridField("score", "Score");
    
    		resultsGrid.setFields(pickedField, resultCustomerIdField, resultsTitleField, resultsManufacturerField, resultsMfrPartNumberField, categoryField,
    				upcField, productIdField, marketsField, scoreField, resultsOutcomeField, creationDateField);
    		resultsGrid.addRecordClickHandler(new RecordClickHandler() {
    			public void onRecordClick(RecordClickEvent event) {
    				populateResultsForm(resultsForm, resultsGrid, event);
    			}
    
    			private void populateResultsForm(final DynamicForm resultsForm, final ListGrid resultsGrid, RecordClickEvent event) {
    				int rowNum = event.getRecordNum();
    				resultsForm.setValue("title", resultsGrid.getRecord(rowNum).getAttribute("title"));
    				resultsForm.setValue("creationDate", resultsGrid.getRecord(rowNum).getAttribute("creationDate"));
    				resultsForm.setValue("manufacturer", resultsGrid.getRecord(rowNum).getAttribute("manufacturer"));
    				resultsForm.setValue("mfrPn", resultsGrid.getRecord(rowNum).getAttribute("mfrPn"));
    				resultsForm.setValue("category", resultsGrid.getRecord(rowNum).getAttribute("category"));
    				resultsForm.setValue("markets", resultsGrid.getRecord(rowNum).getAttribute("markets"));
    				resultsForm.setValue("productId", resultsGrid.getRecord(rowNum).getAttribute("productId"));
    				resultsForm.setValue("outcome", resultsGrid.getRecord(rowNum).getAttribute("outcome"));
    				resultsForm.setValue("score", resultsGrid.getRecord(rowNum).getAttribute("score"));
    				resultsForm.setValue("cdsId", resultsGrid.getRecord(rowNum).getAttribute("cdsId"));
    				resultsForm.setValue("upc", resultsGrid.getRecord(rowNum).getAttribute("upc"));
    			}
    		});
    
    		pickedField.addChangedHandler(new com.smartgwt.client.widgets.grid.events.ChangedHandler() {
    			@Override
    			public void onChanged(com.smartgwt.client.widgets.grid.events.ChangedEvent event) {
    				int rowNum = event.getRowNum();
    				unsetPicked(resultsGrid, rowNum);
    				Record record = resultsGrid.getRecord(rowNum);
    				record.setAttribute("isPicked", event.getValue());
    				resultsGrid.updateData(record);
    			}
    
    			private void unsetPicked(ListGrid resultsGrid, int rowNum) {
    				int totalRows = resultsGrid.getTotalRows();
    				for (int i = 0; i < totalRows; i++) {
    					if (i != rowNum)
    						resultsGrid.setEditValue(i, 0, false);
    				}
    
    			}
    
    		});
    		return resultsGrid;
    	}
    Any suggestions would be appreciated.

    Regards,
    Wade

    #2
    Can you show this as a ready-to-run, standalone test case?

    Comment


      #3
      I get the same error when I call refreshCell on a grid which has only one row and setAlwaysShowEditors(true).

      Code:
      Error:
      	''this._inactiveEditorContextMap' is null or not an object'
      	in http://localhost:8888/SmartGwtTest.html
      	at line 12435
      
          ListGrid._clearingInactiveEditorHTML(rowNum=>0, colNum=>1)
          ListGrid.refreshCell(rowNum=>0,  colNum=>1,  refreshingRow=>undef,  allowEditCellRefresh=>undef)
          StatefulCanvas.handleActivate(event=>Obj,  eventInfo=>undef)
          StatefulCanvas.handleClick(event=>Obj,  eventInfo=>undef)
          EventHandler.bubbleEvent(target=>[IButton ID:isc_OID_2],  eventType=>"click",  eventInfo=>undef,  targetIsMasked=>undef)
          EventHandler.handleClick(target=>[IButton ID:isc_OID_2],  eventType=>undef)
          EventHandler._handleMouseUp(DOMevent=>Obj{type:error},  fakeEvent=>undef)
          EventHandler.handleMouseUp(DOMevent=>Obj{type:error},  fakeEvent=>undef)
          EventHandler.dispatch(handler=>EventHandler.handleMouseUp(),  event=>Obj{type:error})
          anonymous(event=>undef)
              "var returnVal=arguments.callee._window.isc.EH.dispatch(arguments.callee._handler,event);return returnVal;"
      Here is the test case:
      Code:
      package test.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.widgets.IButton;
      import com.smartgwt.client.widgets.events.ClickEvent;
      import com.smartgwt.client.widgets.events.ClickHandler;
      import com.smartgwt.client.widgets.grid.ListGrid;
      import com.smartgwt.client.widgets.grid.ListGridField;
      import com.smartgwt.client.widgets.grid.ListGridRecord;
      import com.smartgwt.client.widgets.layout.VLayout;
      
      /**
       * Entry point classes define <code>onModuleLoad()</code>.
       */
      public class SmartGwtTest implements EntryPoint {
      
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
          VLayout layout = new VLayout();
          layout.setWidth100();
          layout.setHeight100();
      
          final ListGrid listGrid = new ListGrid();
      
          listGrid.setWidth(400);
          listGrid.setHeight(400);
          listGrid.setAlwaysShowEditors(Boolean.TRUE);
      
          ListGridField field1 = new ListGridField("field1", "Field #1", 200);
          ListGridField field2 = new ListGridField("field2", "Field #2", 200);
          listGrid.setFields(field1, field2);
      
          listGrid.setData(getData(1));
      
          layout.addMember(listGrid);
      
          IButton button = new IButton("Change");
          button.addClickHandler(new ClickHandler() {
      
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord[] recs = listGrid.getRecords();
              recs[0].setAttribute("field2", "Changed");
              listGrid.refreshCell(0, 1);
            }
          });
      
          layout.addMember(button);
      
          layout.draw();
        }
      
        private ListGridRecord[] getData(int num) {
          ListGridRecord[] records = new ListGridRecord[num];
          for (int i = 0; i < num; i++) {
            records[i] = new ListGridRecord();
            records[i].setAttribute("field1", "Field 1 Value " + i);
            records[i].setAttribute("field2", "Field 2 Value " + i);
          }
          return records;
        }
      
      }
      If there is more than one row in the grid or if setAlwaysShowEditors is set to false the error isn't displayed. I'm using SmartGWT 2.1.

      Comment


        #4
        Any update?
        I got same problem~

        Comment


          #5
          Hello,

          I also got the same compatibility problem with setAlwaysShowEditors along with Adaptive filter. Any help please!!!

          Thank you

          Comment


            #6
            I am getting the same JS error.

            Any workarounds?

            Comment

            Working...
            X