Announcement

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

    AutoFetchDisplayMap not fetching

    I am having difficulty getting a listgridfield to display more than the value of a foreign key reference to an optionDataSource. AutoFetchDisplayMap is TRUE at both the listgridfield and listgrid levels. I even tried displayValueFromRecord.

    This is AutoMakerApp2:
    Code:
    <DataSource>
        <loadID>AutoMaker</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="AutoMaker" ID="AutoMakerGrid" autoDraw="false">
        <fields>
            <ListGridField name="AUTOMAKERNAME" title="Automakername"/>
        </fields>
        <autoFetchData>true</autoFetchData>
        <recordClick>
                <Action>
                    <target>VehicleGrid</target>
                    <name>fetchRelatedData</name>
                    <title>Fetch Related Data</title>
                    <mapping>
    <value>record</value>
                    <value>viewer</value>
                    <value>null</value>
                    <value>null</value>
                    
                    </mapping>
    
                </Action>
        </recordClick>
    </ListGrid>
    
    
    <DataSource>
        <loadID>Vehicle</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="Vehicle" ID="VehicleGrid" autoDraw="false">
        <fields>
            <ListGridField name="VEHICLENAME" title="Vehiclename"/>
            <ListGridField name="AUTOMAKERID" title="Auto Maker">
                <type>text</type>
                <optionDataSource>AutoMaker</optionDataSource>
                <valueField>AUTOMAKERID</valueField>
                <displayField>AUTOMAKERNAME</displayField>
                <autoFetchDisplayMap>true</autoFetchDisplayMap>
                <displayValueFromRecord>true</displayValueFromRecord>
            </ListGridField>
            <ListGridField name="COLORID" title="Color">
                <type>text</type>
                <optionDataSource>Color</optionDataSource>
                <valueField>COLORID</valueField>
                <displayField>COLORNAME</displayField>
                <autoFetchDisplayMap>true</autoFetchDisplayMap>
                <displayValueFromRecord>true</displayValueFromRecord>
            </ListGridField>
        </fields>
        <autoFetchData>false</autoFetchData>
        <autoFetchDisplayMap>true</autoFetchDisplayMap>
    </ListGrid>
    
    
    <SectionStack ID="SectionStack0" autoDraw="false">
        <sections>
            <SectionStackSection>
                <ID>AutoMakerStackSection</ID>
                <title>AutoMakers</title>
                <autoShow>true</autoShow>
                <items><Canvas ref="AutoMakerGrid"/>
                </items>
            </SectionStackSection>
            <SectionStackSection>
                <ID>VehicleStackSection</ID>
                <title>Vehicles</title>
                <autoShow>true</autoShow>
                <items><Canvas ref="VehicleGrid"/>
                </items>
            </SectionStackSection>
        </sections>
        <visibilityMode>multiple</visibilityMode>
    </SectionStack>
    
    
    <DataView ID="DataView0" overflow="hidden" autoDraw="true">
        <members><Canvas ref="SectionStack0"/>
        </members>
        <width>100%</width>
        <height>100%</height>
    </DataView>
    A screenshot of AutoMakerApp2 is attached along with the last bit of Firebug NET tab and the last portion of the console log.

    The reference is from datasource Vehicle
    Code:
    <DataSource ID="Vehicle" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
        <fields>
            <field name="VEHICLEID" type="sequence" primaryKey="true"/>
            <field name="VEHICLENAME" type="text" required="true" length="64"/>
            <field name="AUTOMAKERID" type="integer" required="true" foreignKey="AutoMaker.AUTOMAKERID">
                <length></length>
            </field>
            <field name="COLORID" type="integer" required="true" title="Color" foreignKey="Color.COLORID">
                <length></length>
            </field>
        </fields>
        <title>Vehicle</title>
        <titleField>VEHICLENAME</titleField>
        <pluralTitle>Vehicles</pluralTitle>
        <generatedBy>SC_SNAPSHOT-2012-03-05_v8.2p/Pro Deployment 2012-03-05</generatedBy>
    </DataSource>
    to Color
    Code:
    <DataSource ID="Color" dataFormat="iscServer" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" tableName="COLOR" autoDeriveSchema="true">
        <fields>
            <field name="COLORID" type="sequence" primaryKey="true"/>
            <field name="COLORNAME" type="text" required="true" length="64" title="Color"/>
        </fields>
        <generatedBy>SC_SNAPSHOT-2012-03-05_v8.2p/Pro Deployment 2012-03-05</generatedBy>
    </DataSource>
    AutoMakerApp2 has no problems showing names from the AutoMaker datasource:
    Code:
    <DataSource ID="AutoMaker" serverType="sql" dataSourceVersion="1" dbName="PlanetProjectDB" schema="PUBLIC" autoDeriveSchema="true">
        <fields>
            <field name="AUTOMAKERID" type="sequence" primaryKey="true"/>
            <field name="AUTOMAKERNAME" type="text" length="64"/>
        </fields>
        <title>Auto Maker</title>
        <titleField>AUTOMAKERNAME</titleField>
        <pluralTitle>Auto Makers</pluralTitle>
        <generatedBy>SC_SNAPSHOT-2012-03-05_v8.2p/Pro Deployment 2012-03-05</generatedBy>
    </DataSource>
    But, I think it is because the records were already fetched to display in the AutoMakerGrid.

    I think I have all the connections OK. Because, if I just add another listgrid to the application with the Color dataSource, then the Vehicle listgrid displays color names properly.

    This is AutoMakerApp3, with the addition:
    Code:
    <DataSource>
        <loadID>AutoMaker</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="AutoMaker" ID="AutoMakerGrid" autoDraw="false">
        <fields>
            <ListGridField name="AUTOMAKERNAME" title="Automakername"/>
        </fields>
        <autoFetchData>true</autoFetchData>
        <recordClick>
                <Action>
                    <target>VehicleGrid</target>
                    <name>fetchRelatedData</name>
                    <title>Fetch Related Data</title>
                    <mapping>
    <value>record</value>
                    <value>viewer</value>
                    <value>null</value>
                    <value>null</value>
                    
                    </mapping>
    
                </Action>
        </recordClick>
    </ListGrid>
    
    
    <DataSource>
        <loadID>Vehicle</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="Vehicle" ID="VehicleGrid" autoDraw="false">
        <fields>
            <ListGridField name="VEHICLENAME" title="Vehiclename"/>
            <ListGridField name="AUTOMAKERID" title="Auto Maker">
                <type>text</type>
                <optionDataSource>AutoMaker</optionDataSource>
                <valueField>AUTOMAKERID</valueField>
                <displayField>AUTOMAKERNAME</displayField>
                <autoFetchDisplayMap>true</autoFetchDisplayMap>
                <displayValueFromRecord>true</displayValueFromRecord>
            </ListGridField>
            <ListGridField name="COLORID" title="Color">
                <type>text</type>
                <optionDataSource>Color</optionDataSource>
                <valueField>COLORID</valueField>
                <displayField>COLORNAME</displayField>
                <autoFetchDisplayMap>true</autoFetchDisplayMap>
                <displayValueFromRecord>true</displayValueFromRecord>
            </ListGridField>
        </fields>
        <autoFetchData>false</autoFetchData>
        <autoFetchDisplayMap>true</autoFetchDisplayMap>
    </ListGrid>
    
    
    <DataSource>
        <loadID>Color</loadID>
    </DataSource>
    
    
    <ListGrid dataSource="Color" ID="ListGrid3" autoDraw="false">
        <fields>
            <ListGridField name="COLORID" title="Colorid"/>
            <ListGridField name="COLORNAME" title="Color"/>
        </fields>
        <autoFetchData>true</autoFetchData>
    </ListGrid>
    
    
    <SectionStack ID="SectionStack0" autoDraw="false">
        <sections>
            <SectionStackSection>
                <ID>AutoMakerStackSection</ID>
                <title>AutoMakers</title>
                <autoShow>true</autoShow>
                <items><Canvas ref="AutoMakerGrid"/>
                </items>
            </SectionStackSection>
            <SectionStackSection>
                <ID>VehicleStackSection</ID>
                <title>Vehicles</title>
                <autoShow>true</autoShow>
                <items><Canvas ref="VehicleGrid"/>
                </items>
            </SectionStackSection>
            <SectionStackSection>
                <ID>SectionStackSection3</ID>
                <title>SectionStackSection3</title>
                <autoShow>true</autoShow>
                <items><Canvas ref="ListGrid3"/>
                </items>
            </SectionStackSection>
        </sections>
        <visibilityMode>multiple</visibilityMode>
    </SectionStack>
    
    
    <DataView ID="DataView0" overflow="hidden" autoDraw="true">
        <members><Canvas ref="SectionStack0"/>
        </members>
        <width>100%</width>
        <height>100%</height>
    </DataView>
    A screen shot of AutoMakerApp3 is also attached.

    I thought it might be a problem with HSQLDB, until I saw the displayValues resolve with AutoMakerApp3.

    Thanks,

    Rick

    P.S. I am running SmartClient Version: SmartClient_SC_SNAPSHOT-2012-03-05_v82p/Pro Development Only (built 2012-03-05) on Mozilla Firefox 3.6.18 with Firebug using Windows XP Pro 32 bit.

    P.P.S. I am trying with other apps to see if I can get AutoFetchDisplayMap to trigger. I have set ListGrid.autoFetchDisplayMap to an explicit TRUE and checked the XML code. Nothing comes up. I checked around in the reference to see I had stepped on something. But, the description is pretty strong. It says the "valueMap will be automatically created". I am not messing with a custom datasource or anything.

    ListGrid.autoFetchDisplayMap [IRW] type:Boolean, defaultValue: true

    If true, for fields where ListGridField.optionDataSource is specified, a valueMap will be automatically created by making a DataSource.fetchData() call against the specified dataSource and extracting a valueMap from the returned records based on the displayField and valueField.

    If set to false, valueMaps will not be automatically fetched. In this case, setting field.optionDataSource is effectively a shortcut for setting optionDataSource on the editor via ListGridField.editorProperties.

    Can also be disabled on a per-field basis with ListGridField.autoFetchDisplayMap.

    See Also:
    ListGridField.autoFetchDisplayMap
    ListGridField.optionDataSource
    It is magic that adding the third grid fixes things in another grid. This is not mentioned in the reference. So, maybe the magic works in reverse when the third grid is absent.
    Attached Files
    Last edited by RickBollinger; 3 Apr 2012, 07:02.
Working...
X