Hello,
I currently evaluating the smartgwt enterprise edition (3.1d) and got tried to use dynamic field include combined with drag-copy.
These are my classes:
and the DatasourceDefinitions:
And the EntryPoint (copied and modified from http://www.smartclient.com/smartgwte...ase/#form_copy). I added one ListGridField with setIncludeFrom:
Now if I drag a attributeDefinition to the attribute grid, the field "type" is empty. After reloading the grid the field is populated as expected.
Here is the server log for the drag operation:
I think the problem is, that the add-operation has no property "additionalOutputs" so the response to this request doesn't include these dynamic fields.
I currently evaluating the smartgwt enterprise edition (3.1d) and got tried to use dynamic field include combined with drag-copy.
These are my classes:
Code:
@Entity @Table(name = "attribute") public class Attribute { @Id @Column(nullable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String value; @ManyToOne private AttributeDefinition definition; /* ... getter and setter ... */
Code:
@Entity @Table(name="attribute_definition") public class AttributeDefinition{ @Id private String name; private String type; /* ... getter and setter ... */
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DataSource ID="attribute" serverType="hibernate" dropExtraFields="true" beanClassName="test.Attribute"> <fields> <field name="id" type="sequence" primaryKey="true" /> <field name="value" type="text"/> <field name="definition" required="true" canEdit="true" foreignKey="attributeDefinition.name"/> </fields> </DataSource>
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DataSource ID="attributeDefinition" serverType="hibernate" dropExtraFields="true" beanClassName="test.AttributeDefinition" > <fields> <field name="name" type="text" primaryKey="true"/> <field name="type" type="text" /> </fields> </DataSource>
Code:
public class Entry implements EntryPoint { public void onModuleLoad() { final ListGrid attributeDefinition = new ListGrid(); attributeDefinition.setDataSource(DataSource.get("attributeDefinition")); attributeDefinition.setCanDragRecordsOut(true); attributeDefinition.setDragDataAction(DragDataAction.COPY); attributeDefinition.setAlternateRecordStyles(true); attributeDefinition.setAutoFetchData(true); attributeDefinition.setFields( new ListGridField("name"), new ListGridField("type")); final ListGrid attribute = new ListGrid(); attribute.setDataSource(DataSource.get("attribute")); attribute.setCanAcceptDroppedRecords(true); attribute.setCanRemoveRecords(true); attribute.setAlternateRecordStyles(true); attribute.setAutoFetchData(true); attribute.setAutoFetchTextMatchStyle(TextMatchStyle.EXACT); [b]ListGridField type = new ListGridField("type"); type.setIncludeFrom("attributeDefinition.type");[/b] attribute.setFields( new ListGridField("id"), new ListGridField("value"), new ListGridField("definition"), type); HLayout mainLayout = new HLayout(); mainLayout.setWidth100(); mainLayout.setHeight100(); mainLayout.addMember(attributeDefinition); mainLayout.addMember(attribute); mainLayout.draw(); }
Here is the server log for the drag operation:
Code:
=== 2012-09-20 00:50:29,215 [80-1] INFO RequestContext - URL: '/test/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2': Moz (Gecko) with Accept-Encoding header === 2012-09-20 00:50:29,216 [80-1] DEBUG IDACall - Header Name:Value pair: host:127.0.0.1:8080 === 2012-09-20 00:50:29,216 [80-1] DEBUG IDACall - Header Name:Value pair: user-agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 === 2012-09-20 00:50:29,216 [80-1] DEBUG IDACall - Header Name:Value pair: accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 === 2012-09-20 00:50:29,217 [80-1] DEBUG IDACall - Header Name:Value pair: accept-language:de,de-de;q=0.7,en;q=0.3 === 2012-09-20 00:50:29,217 [80-1] DEBUG IDACall - Header Name:Value pair: accept-encoding:gzip, deflate === 2012-09-20 00:50:29,217 [80-1] DEBUG IDACall - Header Name:Value pair: connection:keep-alive === 2012-09-20 00:50:29,217 [80-1] DEBUG IDACall - Header Name:Value pair: content-type:application/x-www-form-urlencoded; charset=UTF-8 === 2012-09-20 00:50:29,217 [80-1] DEBUG IDACall - Header Name:Value pair: referer:http://127.0.0.1:8080/index.html?gwt.codesvr=127.0.0.1:9997 === 2012-09-20 00:50:29,219 [80-1] DEBUG IDACall - Header Name:Value pair: content-length:1017 === 2012-09-20 00:50:29,219 [80-1] DEBUG IDACall - Header Name:Value pair: cookie:GLog=%7B%0D%20%20%20%20left%3A960%2C%20%0D%20%20%20%20top%3A0%2C%20%0D%20%20%20%20width%3A942%2C%20%0D%20%20%20%20height%3A921%2C%20%0D%20%20%20%20priorityDefaults%3A%7B%0D%20%20%20%20%20%20%20%20Log%3A4%0D%20%20%20%20%7D%2C%20%0D%20%20%20%20defaultPriority%3A4%2C%20%0D%20%20%20%20trackRPC%3Atrue%0D%7D; isc_cState=ready; JSESSIONID=65F1CA2528F94458B9789A87FDCDE111 === 2012-09-20 00:50:29,221 [80-1] DEBUG IDACall - Header Name:Value pair: pragma:no-cache === 2012-09-20 00:50:29,221 [80-1] DEBUG IDACall - Header Name:Value pair: cache-control:no-cache === 2012-09-20 00:50:29,221 [80-1] DEBUG IDACall - session exists: 65F1CA2528F94458B9789A87FDCDE111 === 2012-09-20 00:50:29,221 [80-1] DEBUG IDACall - remote user: null === 2012-09-20 00:50:29,224 [80-1] DEBUG XML - Parsed XML from (in memory stream): 2ms === 2012-09-20 00:50:29,227 [80-1] DEBUG RPCManager - Processing 1 requests. === 2012-09-20 00:50:29,230 [80-1] DEBUG RPCManager - Request #1 (DSRequest) payload: { values:{ name:"bar", type:"boolean", definition:"bar" }, operationConfig:{ dataSource:"attribute", operationType:"add" }, componentId:"isc_ListGrid_1", appID:"builtinApplication", operation:"attribute_add", oldValues:{ name:"bar", type:"boolean", definition:"bar" }, criteria:{ } } === 2012-09-20 00:50:29,233 [80-1] INFO IDACall - Performing 1 operation(s) === 2012-09-20 00:50:29,233 [80-1] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2012-09-20 00:50:29,233 [80-1] DEBUG DeclarativeSecurity - DataSource attribute is not in the pre-checked list, processing... === 2012-09-20 00:50:29,233 [80-1] DEBUG AppBase - [builtinApplication.attribute_add] No userTypes defined, allowing anyone access to all operations for this application === 2012-09-20 00:50:29,233 [80-1] DEBUG AppBase - [builtinApplication.attribute_add] No public zero-argument method named '_attribute_add' found, performing generic datasource operation === 2012-09-20 00:50:29,235 [80-1] INFO HibernateDataSource - [builtinApplication.attribute_add] Performing add operation with criteria: {name:"bar",type:"boolean",definition:"bar"} values: {name:"bar",type:"boolean",definition:"bar"} === 2012-09-20 00:50:29,256 [80-1] DEBUG HibernateTransaction - [builtinApplication.attribute_add] Started new transaction "1559411372" Hibernate: select attributed0_.name as name1_, attributed0_.type as type1_ from attribute_definition attributed0_ where attributed0_.name=? Hibernate: insert into attribute (definition_name, value) values (?, ?) === 2012-09-20 00:50:29,263 [80-1] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8 === 2012-09-20 00:50:29,264 [80-1] INFO HibernateTransaction - Attempting to commit 1 database update(s) === 2012-09-20 00:50:29,264 [80-1] DEBUG HibernateTransaction - Committing transaction "1559411372" === 2012-09-20 00:50:29,299 [80-1] DEBUG RPCManager - non-DMI response, dropExtraFields: true === 2012-09-20 00:50:29,302 [80-1] INFO Compression - /test/sc/IDACall: 171 -> 151 bytes === 2012-09-20 00:54:27,000 [80-1] INFO Download - Returning 304: Not modified on conditional get of: C:\Projekte\test\smartgwtee-3.0p\samples\test\out\artifacts\test_war_exploded\test\sc\skins\Enterprise\images\ListGrid\sort_descending.png
Comment