Announcement

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

    Removing columns from list grid after filter causes error.

    1. SmartClient Version: v10.0p_2014-09-29/LGPL Development Only (built 2014-09-29)

    2. Browser : FF 24.7 ESR

    Our application has hundreds of possible columns for a list grid and they may change dynamically. Adding a grid column, filtering by that column and then removing the column causes the error below. I have included a sample front end and Spring controller. To reproduce the issue, click on the 'Update Columns' button, filter the 'Description' column, and then click the 'Refresh' button. This issue began when we upgraded to SmartGWT 5.


    Code:
    11:38:53.415:MUP6:WARN:Log:com.google.gwt.core.client.JavaScriptException: (TypeError): _4 is null
     fileName: http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js
     stack: isc_ListGrid_storeUpdatedEditorValue@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js:1995
    isc_ListGrid_setFields@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js:1090
    isc_c_Class_invokeSuper@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:255
    isc_c_Class_Super@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:247
    isc_RecordEditor_setFields@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js:2943
    isc_ListGrid_setFields@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js:1101
    isc_Canvas_setDataSource@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:3021
    isc_c_Class_invokeSuper@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:255
    isc_c_Class_Super@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:247
    isc_ListGrid_setDataSource@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js:1146
    isc_Class_setProperties@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:310
    isc_Class_setProperty@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:309
    CE@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:768
    vE@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1014
    bG@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1521
    ggb@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1640
    fZ@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1634
    ae@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1554
    Qd@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1500
    Jp@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:526
    Kp@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1628
    dF/f<@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1527
    Wc@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:722
    Zc@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1499
    Yc/<@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1230
    dF/d.click@http://star.unival.com:8080/smart-gwt-0/main/762F2B54E0685682C784F007AEC1B75B.cache.html:1527
    isc_StatefulCanvas_handleActivate@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Foundation.js:210
    isc_StatefulCanvas_handleClick@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Foundation.js:211
    isc_c_EventHandler_bubbleEvent@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:1510
    isc_c_EventHandler_handleClick@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:1371
    isc_c_EventHandler__handleMouseUp@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:1356
    isc_c_EventHandler_handleMouseUp@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:1347
    isc_c_EventHandler_dispatch@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:1585
    anonymous@http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Core.js:55
    
     lineNumber: 1995
     columnNumber: 225
    11:38:53.442:MUP6[E0]:WARN:Log:Uncaught JavaScript exception: TypeError: _4 is null in http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js, line 1995
    11:38:53.600:TMR4:WARN:Log:TypeError: _4 is null
    Stack from error.stack:
        ListGrid.storeUpdatedEditorValue() @ main/sc/modules/ISC_Grids.js:1995
        ListGrid.getEditValues() @ main/sc/modules/ISC_Grids.js:1883
        ListGrid.getEditedRecord() @ main/sc/modules/ISC_Grids.js:1886
        GridBody._updateEditItems() @ main/sc/modules/ISC_Grids.js:760
        GridBody.redraw() @ main/sc/modules/ISC_Grids.js:751
        [c]Canvas.clearRedrawQueue() @ main/sc/modules/ISC_Core.js:2837
        [c]Class.fireCallback() @ main/sc/modules/ISC_Core.js:264
        Timer._fireTimeout() @ main/sc/modules/ISC_Core.js:1237
        Timer.setTimeout/_6<() @ main/sc/modules/ISC_Core.js:1235
    
    11:38:53.601:TMR4:WARN:Log:Uncaught JavaScript exception: TypeError: _4 is null in http://star.unival.com:8080/smart-gwt-0/main/sc/modules/ISC_Grids.js, line 1995

    Here is a sample app

    Code:
    public class Main implements EntryPoint {
    	@Override
    	public void onModuleLoad() {
    		final List<DataSourceField> dsFields = new ArrayList<DataSourceField>(){{
    			add(new DataSourceIntegerField("id", "Id"){{setPrimaryKey(true);}});
    			add(new DataSourceTextField("name", "Name"));
    		}};
    		final List<ListGridField> lgFields = new ArrayList<ListGridField>(){{
    			add(new ListGridField("id", "Id"));
    			add(new ListGridField("name", "Name"));
    		}};
    		
    		final List<DataSourceField> dsFields1 = new ArrayList<DataSourceField>(){{
    			add(new DataSourceIntegerField("id", "Id"){{setPrimaryKey(true);}});
    			add(new DataSourceTextField("name", "Name"));
    			add(new DataSourceTextField("description", "Description"));
    		}};
    		final List<ListGridField> lgFields1 = new ArrayList<ListGridField>(){{
    			add(new ListGridField("id"));
    			add(new ListGridField("name"));
    			add(new ListGridField("description"));
    		}};
    		
    		
    		
    		final DataSource ds = new RestDataSource("service/items", null){{
    			 setFields(dsFields.toArray(new DataSourceField[dsFields.size()]));
    		}};
    		 
    		final ListGrid grid = new ListGrid(){{			
    			setFetchDelay(400);
    			setCanEdit(false);
    			setCanMultiSort(false);
    			setAutoFetchData(true);
    			setShowFilterEditor(true);
    			setFilterOnKeypress(true);
    			setDataProperties(new ResultSet(){{
    				setUseClientFiltering(false);
    			}});
    			setDataSource(ds);
    			setFields(lgFields.toArray(new ListGridField[lgFields.size()]));
    		 }};
    		 
    		 VLayout section = new VLayout(4);
    		 section.setHeight100();
    		 section.setWidth100();
    		 section.addMember(grid);
    		 section.addMember(new HLayout(4){{
    			 addMember(new Button("Update Columns"){{
    					addClickHandler(new ClickHandler() {
    						@Override
    						public void onClick(ClickEvent event) {
    							grid.setDataSource(new RestDataSource("service/items", null){{
    								 setFields(dsFields1.toArray(new DataSourceField[dsFields1.size()]));
    							}});
    							grid.setFields(lgFields1.toArray(new ListGridField[lgFields1.size()]));
    							grid.invalidateCache();
    							grid.fetchData();
    						}
    					});
    				}});
    			 addMember(new Button("Refresh"){{
    				addClickHandler(new ClickHandler() {
    					@Override
    					public void onClick(ClickEvent event) {
    						grid.setDataSource(new RestDataSource("service/items", null){{
    							 setFields(dsFields.toArray(new DataSourceField[dsFields.size()]));
    						}});
    						grid.setFields(lgFields.toArray(new ListGridField[lgFields.size()]));
    						grid.invalidateCache();
    						grid.fetchData();
    					}
    				});
    			}});
    		}});
    		section.show();
    	}	
    }
    And a sample Spring controller
    Code:
    @Controller
    public class RestController {
    	
    	@JsonAutoDetect
    	private static class Item{
    		@JsonProperty
    		int id;
    		@JsonProperty
    		String name;
    		@JsonProperty
    		String description;
    		
    		public Item(int id, String name, String description){
    			this.id = id;
    			this.name = name;
    			this.description = description;
    		}
    	}
    	
    	private static List<Item> items = new ArrayList<Item>();
    	
    	static{
    		for(int i = 0; i <= 10; i++){
    			Item item = new Item(i, "Name" + i, "Desc" + i);
    			items.add(i, item);
    		}
    	}
    	
    	@RequestMapping(value="/items")
    	@ResponseBody
    	public Response<Item> items(@RequestBody MappedRequest request){
    			return new Response<Item>(items, 0, 10, 10);
    	}
    	
    	@ExceptionHandler
    	public void onException(Exception exception){
    		exception.printStackTrace();
    	}
    }

    #2
    Please check this out against the latest build, it looks like an already-fixed bug.

    Note it's not technically allowed to re-use the same DataSourceField and ListGridField instances across different DataSources and ListGrids - you need to provide fresh instances. It's not clear whether that's the problem here, but you should correct this in your real application if it exists there too.

    Comment


      #3
      Tried with the latest build - SmartClient Version: v10.0p_2014-10-20/LGPL Development Only (built 2014-10-20)

      Modified the code so that ListGridField's and DataSourceFields's are not being re-used. Still getting the error



      Code:
      public class Main implements EntryPoint {
      	@Override
      	public void onModuleLoad() {
      		final List<DataSourceField> dsFields = new ArrayList<DataSourceField>(){{
      			add(new DataSourceIntegerField("id", "Id"){{setPrimaryKey(true);}});
      			add(new DataSourceTextField("name", "Name"));
      		}};
      		final List<ListGridField> lgFields = new ArrayList<ListGridField>(){{
      			add(new ListGridField("id", "Id"));
      			add(new ListGridField("name", "Name"));
      		}};
      		
      		final List<DataSourceField> dsFields1 = new ArrayList<DataSourceField>(){{
      			add(new DataSourceIntegerField("id", "Id"){{setPrimaryKey(true);}});
      			add(new DataSourceTextField("name", "Name"));
      			add(new DataSourceTextField("description", "Description"));
      		}};
      		final List<ListGridField> lgFields1 = new ArrayList<ListGridField>(){{
      			add(new ListGridField("id"));
      			add(new ListGridField("name"));
      			add(new ListGridField("description"));
      		}};
      		
      		final List<DataSourceField> dsFields2 = new ArrayList<DataSourceField>(){{
      			add(new DataSourceIntegerField("id", "Id"){{setPrimaryKey(true);}});
      			add(new DataSourceTextField("name", "Name"));
      		}};
      		final List<ListGridField> lgFields2 = new ArrayList<ListGridField>(){{
      			add(new ListGridField("id", "Id"));
      			add(new ListGridField("name", "Name"));
      		}};
      		
      		
      		
      		final DataSource ds = new RestDataSource("service/items", null){{
      			 setFields(dsFields.toArray(new DataSourceField[dsFields.size()]));
      		}};
      		 
      		final ListGrid grid = new ListGrid(){{			
      			setFetchDelay(400);
      			setCanEdit(false);
      			setCanMultiSort(false);
      			setAutoFetchData(true);
      			setShowFilterEditor(true);
      			setFilterOnKeypress(true);
      			setDataProperties(new ResultSet(){{
      				setUseClientFiltering(false);
      			}});
      			setDataSource(ds);
      			setFields(lgFields.toArray(new ListGridField[lgFields.size()]));
      		 }};
      		 
      		 VLayout section = new VLayout(4);
      		 section.setHeight100();
      		 section.setWidth100();
      		 section.addMember(grid);
      		 section.addMember(new HLayout(4){{
      			 addMember(new Button("Update Columns"){{
      					addClickHandler(new ClickHandler() {
      						@Override
      						public void onClick(ClickEvent event) {
      							grid.setDataSource(new RestDataSource("service/items", null){{
      								 setFields(dsFields1.toArray(new DataSourceField[dsFields1.size()]));
      							}});
      							grid.setFields(lgFields1.toArray(new ListGridField[lgFields1.size()]));
      							grid.invalidateCache();
      							grid.fetchData();
      						}
      					});
      				}});
      			 addMember(new Button("Refresh"){{
      				addClickHandler(new ClickHandler() {
      					@Override
      					public void onClick(ClickEvent event) {
      						grid.setDataSource(new RestDataSource("service/items", null){{
      							 setFields(dsFields2.toArray(new DataSourceField[dsFields2.size()]));
      						}});
      						grid.setFields(lgFields2.toArray(new ListGridField[lgFields2.size()]));
      						grid.invalidateCache();
      						grid.fetchData();
      					}
      				});
      			}});
      		}});
      		section.show();
      	}	
      }

      Comment


        #4
        Hmm. We're taking a look. We'll let you know what we find.

        Regards
        Isomorphic Software

        Comment


          #5
          We've made a change which we think will address this issue. Please try the next nightly build (dated Oct 22 or above).

          Regards
          Isomorphic Software

          Comment

          Working...
          X