I've created a dynamic data source from an xsd file following the example on the showcase. I'm using SmartGWT 2.2 for this project. The xsd consists of complex types that include other complex types. Is there a limit to how many levels of types SmartGWT will include in the form? The form shows one level of complex type but fails to resolve a second level as in:
In this structure, elements or attributes from complex2 and complex3 are included in the form, but complexTypes in those structures are not in the form. Can I conclude that a datasource from an xsd will automatically generate fields for the top level elements and attributes, and only elements and attributes from any referenced complexType (and not additional levels of complexType)? I'm using code similar to this to setup the form:
If my interpretation of this is correct, then I can (fortunately) modify the xsd to conform to the way it is used by SmartGWT to produce the dynamic form.
Code:
<complexType name="nameUsedForDatasource"> <sequence> <element name="field1" type="int"></element> <element name="field2" type="complex2"></element> <element name="field3" type="int"></element> <element name="field4" type="int"></element> <element name="field5" type="string"></element> <element name="field6" type="complex3" minOccurs="0" maxOccurs="1"></element> <element name="field7" type="complex3" minOccurs="0" maxOccurs="1"></element> </sequence> </complexType>
Code:
XMLTools.loadXMLSchema( "app/files/target.xsd", new XSDLoadCallback() { public void execute( SchemaSet schemaSet ) { loadXMLSchemaReply( schemaSet, dynamicForm ); } } ); private void loadXMLSchemaReply( SchemaSet schemaSet, DynamicForm dynamicForm ) { DataSource schemaDS = schemaSet.getSchema( "Target" ); DataSource dataSource = new DataSource(); dataSource.setInheritsFrom( schemaDS ); dataSource.setUseParentFieldOrder( true ); dynamicForm.setDataSource( dataSource ); }