Announcement

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

    DataSource.getFieldXML and valueMaps

    In our application we have some dynamic datasource generators. Basically what they do is take an existing static datasource file and then append some extra fields to it.

    Code:
    DataSource staticDataSource = DataSource.forName(id + "_static", request);
    List<DSField> fields = staticDataSource.getLocalFields();
    addCustomFields(fields, id);
    System.err.println(DataSource.getFieldXML(fields));
    However there is one problem when the original static datasource contains a valuemap:

    Code:
    <field type="enum" length="20" name="cntn_status" title="">
    	<valueMap>
    		<value ID="10">Pending</value>
    		<value ID="20">Available</value>
    		<value ID="30">Labeled</value>
    		<value ID="40">Approved</value>
    		<value ID="50">Removed</value>
    		<value ID="60">Cancelled</value>
    	</valueMap> 
    </field>
    The output of getFieldXml on this field will be:

    Code:
    <field title="" name="cntn_status" length="20" required="true">
    	<valueMap 10="Pending" 20="Available" 30="Labeled" 40="Approved" 50="Removed" 60="Cancelled"></valueMap>
    </field>
    I tried some manipulation serverside to the DSField objects to fix this, but I can't get it right: i can't really specify the content of the values (like "Pending", "Available", ...) in that. Do you have any directions?

    This is on SmartGWT 2.5, GWT 2.1, Firefox 5.

    #2
    getFieldXML() is an undocumented internal method (yes, we know it has the Java "public" qualifier - still, you need to stick to documented methods).

    Instead, just provide the entire XML dynamically.

    Comment

    Working...
    X