Using SmartGWT 3.0 on Firefox 7.0...
I've been trying to create a simple ListGrid based on the "Edit By Cell" example in the SmartGWT Showcase. The data in my DataSource is programmatically generated, and I'm using a custom subclass of Record to represent the data.
All the rendering works fine, including the value of the attribute that I've marked as the primary key. The problem starts when I attempt to edit a cell within a row. I get the following stack trace:
I don't understand why this is, because I set the primaryKey attribute in the ListGrid (a unique-by-row, ever-increasing integer value). I've also verified that the attribute 'pk' is set in the Record. I did this via setting an EditCompleteHandler on the ListGrid, and then calling a custom method that dumps the attribute values out by attribute name. The 'pk' attribute is clearly set for each record. Also, in the above CODE example, you can see that it knows that 'pk 6' has been edited, which adds to the confusion.
Also, when I edit a field, the new value displays for a moment, but the row eventually disappears from the ListGrid. I've called "setCanRemoveRecords(false)" on my ListGrid, but that hasn't helped.
Is there an example in the Showcase that demonstrates editing on Record subclasses that are not initially populated from an XML file?
Somewhat related question: Is the "best practice" for a ListGrid to call setDataSource only once during the ListGrid's lifespan, and then cause that data source's content to change one way or another, OR, can new data sources be instantiated at will, each time being followed by a call to "setDataSource"?
My application involves some server-side processing where it's natural to create a new data source upon the completion of that work, and then to set the new data source to the ListGrid thereafter. However, I've noticed that the fields in the table need to be reset after each "setDataSource" call, hence my "best practices" question.
Is there an example that shows a subclass of DataSource where various methods are overriden that demonstrate the events that happen when a Record is edited?
I've been trying to create a simple ListGrid based on the "Edit By Cell" example in the SmartGWT Showcase. The data in my DataSource is programmatically generated, and I'm using a custom subclass of Record to represent the data.
All the rendering works fine, including the value of the attribute that I've marked as the primary key. The problem starts when I attempt to edit a cell within a row. I get the following stack trace:
Code:
ERROR: 19:21:42.490:TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'pk'. com.smartgwt.client.core.JsObject$SGWT_WARN: 19:21:42.490:TMR4:WARN:Log:findByKeys: passed record does not have a value for key field 'pk' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:680) ERROR: 19:21:42.490:TMR4:WARN:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):Update operation - submitted record with primary key value[s]:{pk: 6} returned with modified primary key:{}. This may indicate bad server logic. Updating cache to reflect new primary key.. com.smartgwt.client.core.JsObject$SGWT_WARN: 19:21:42.490:TMR4:WARN:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):Update operation - submitted record with primary key value[s]:{pk: 6} returned with modified primary key:{}. This may indicate bad server logic. Updating cache to reflect new primary key. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) at java.lang.Thread.run(Thread.java:680)
I don't understand why this is, because I set the primaryKey attribute in the ListGrid (a unique-by-row, ever-increasing integer value). I've also verified that the attribute 'pk' is set in the Record. I did this via setting an EditCompleteHandler on the ListGrid, and then calling a custom method that dumps the attribute values out by attribute name. The 'pk' attribute is clearly set for each record. Also, in the above CODE example, you can see that it knows that 'pk 6' has been edited, which adds to the confusion.
Also, when I edit a field, the new value displays for a moment, but the row eventually disappears from the ListGrid. I've called "setCanRemoveRecords(false)" on my ListGrid, but that hasn't helped.
Is there an example in the Showcase that demonstrates editing on Record subclasses that are not initially populated from an XML file?
Somewhat related question: Is the "best practice" for a ListGrid to call setDataSource only once during the ListGrid's lifespan, and then cause that data source's content to change one way or another, OR, can new data sources be instantiated at will, each time being followed by a call to "setDataSource"?
My application involves some server-side processing where it's natural to create a new data source upon the completion of that work, and then to set the new data source to the ListGrid thereafter. However, I've noticed that the fields in the table need to be reset after each "setDataSource" call, hence my "best practices" question.
Is there an example that shows a subclass of DataSource where various methods are overriden that demonstrate the events that happen when a Record is edited?
Comment