Go Back   SmartClient Forums > Smart GWT Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 16th Dec 2009, 05:07
itb itb is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default SmartGWT 2.0 and changing ListGrid DataSource

Hi,

great work on the new release!
We changed to GWT 2.0 / smartGWT 2.0 yesterday. We have found an issue on a ListGrid, which switches datasources. There are, say, 5 datasources and 1 ListGrid. When the user chooses an option in a SelectItem, the ListGrid's dataSource is set to one of these 5, and fetchData is called:

Code:
   public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
        this.grid.setDataSource(this.dataSource);
        this.grid.fetchData();
    }
On the previous version this works great, but in the new version it doesn't allways display the records. Is does show (in alternating style) the number of records, but they are all empty. This doesn't happen everytime. After the first problem the grid keeps having all kinds of different erronious behaviour like posting requests for the previous datasource, or showing data from the previous request. It logs an error in the console, which is:

Code:
Uncaught JavaScript exception [_3 is undefined] in http://localhost:8888/sc/modules/ISC_Core.js, line 3355
any ideas?

For now, I have a workaround by removing the ListGrid, adding a new one and setting the datasource on that new one, but it's a lot slower, probably because of the dom-manipulation.
Reply With Quote
  #2  
Old 16th Dec 2009, 05:20
jpaumard jpaumard is offline
Registered Developer
 
Join Date: Feb 2009
Posts: 20
Default

I noticed the exact same issue, after moving from GWT 1.7 / SmartGWT 1.3 to GWT 2.0 / SmartGWT 2.0.

Then I rolled back to GWT 2.0 / SmartGWT 1.3, and still have the issue.

Rolling back to GWT 1.7 seems to need the uninstalling of the OOPHM IE plug-in, which is another issue btw...

Any help/ hint / advice will be most welcomed !

Thank you,

José
Reply With Quote
  #3  
Old 16th Dec 2009, 07:21
smartgwt.dev smartgwt.dev is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 1,091
Default

Please post a minimal standalone testcase, or modifications to a showcase sample that demonstrates the issue.
Reply With Quote
  #4  
Old 16th Dec 2009, 17:02
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,615
Default

Posting the stack trace from IE (see the FAQ) would also help.
Reply With Quote
  #5  
Old 17th Dec 2009, 12:17
itb itb is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default requested stacktrace

here's the stacktrace:

Code:
MUP7:WARN:Log:Error:
	''userSummary' is null or not an object'
	in http://localhost:8888/sc/modules/ISC_Core.js
	at line 3355
    Canvas.getRecordHiliteCSSText(_1=>null, _2=>"color:#0066CC;", _3=>undef)
    ListGrid.getCellCSSText(_1=>null, _2=>0, _3=>3)
    [a]GridBody.getCellCSSText(record=>null, rowNum=>0, colNum=>3)
    GridRenderer.$29i(_1=>null, _2=>0, _3=>3, _4=>"recordEditorCell")
    GridRenderer.$29h(_1=>null, _2=>0, _3=>3, _4=>[TDElement]{nodeName:TD}, _5=>"recordEditorCell", undef, undef, undef)
    Class.invokeSuper(_1=>[Class GridBody], _2=>"$29h", _3=>null, _4=>0, _5=>3, _6=>[TDElement]{nodeName:TD}, _7=>undef, _8=>undef, _9=>undef, _10=>undef)
    GridBody.$29h(_1=>null, _2=>0, _3=>3, _4=>[TDElement]{nodeName:TD}, _5=>undef, _6=>undef, _7=>undef, _8=>undef)
    GridRenderer.setRowStyle(_1=>0, _2=>undef, _3=>3)
    GridRenderer.setCellStyle(_1=>0, _2=>3, _3=>undef)
    GridRenderer.refreshCellStyle(_1=>0, _2=>3, _3=>undef)
    ListGrid.refreshCell(_1=>0, _2=>3, _3=>true, _4=>undef)
    ListGrid.refreshRow(_1=>0)
    ListGrid.hideInlineEditor(_1=>false, _2=>true)
    ListGrid.setFields(_1=>Array[3])
    ** recursed on Class.invokeSuper
FYI: when trying to recreate the old code (I implemented the workaroud) I forgot to call grid.setWidth100(), and it seemed as if I couldn't reproduce the problem. When I added the setWidth100() call, I could, resulting in the above trace.

Last edited by itb; 17th Dec 2009 at 12:24..
Reply With Quote
  #6  
Old 17th Dec 2009, 13:16
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,615
Default

This seems to be a problem with calling setDataSource() on a ListGrid where inline editing is currently enabled. You should be able to get around this by calling endEditing() before setDataSource(). However, what were you expecting / relying on happening with the inline editor when you changed DataSources?
Reply With Quote
  #7  
Old 17th Dec 2009, 13:22
itb itb is offline
Registered Developer
 
Join Date: Nov 2008
Posts: 26
Default

it's a read only grid, there are no editors in it. The columns are derived from the different datasources using setUseAllDataSourceFileds(true). Most fields are DataSourceTextFields and DataSourceIntegerFields (most editable, but not in this grid). There are also some DataSourceBooleanFields and DataSourceDateFields, which are also readonly in this grid, could these be causing the problem (just a hunch, because they use more complicated renderers)? Also, the grid has setShowFilterEditor(true), but the problem occurs if there is no filter specified.

The problem occurs when I switch the datasources a couple of times using a SelectItem, so the focus is never inside the grid (always on the SelectItem).

Last edited by itb; 17th Dec 2009 at 13:45..
Reply With Quote
  #8  
Old 17th Dec 2009, 13:45
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,615
Default

Whether fields are individually editable or not, you've got an active editor (triggered by startEditing() or by the editEvent). Again, try the suggested workaround and let us know if that fixes it.
Reply With Quote
  #9  
Old 17th Dec 2009, 13:47
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,615
Default

Oh you've got a filterEditor showing? That's the active editor then. We'll take another look.
Reply With Quote
  #10  
Old 23rd Dec 2009, 08:43
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,615
Default

We've now added some code to the SmartClient codebase to resolve this issue. This will hit SVN soon

Thanks
Isomorphic Software
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved