Announcement

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

    extra fetch with useLocalDisplayFieldValue when using ValuesManager

    SmartClient Version: v13.0p_2024-02-01/Enterprise Development Only (built 2024-02-01)
    Chrome on MacOS

    Hello, please try this test case:

    Code:
    isc.DynamicForm.create({
        ID: "testForm",
        fields: [
            {
                name: "itemID",
                editorType: "ComboBoxItem",
                canEdit: true,
                optionDataSource: "supplyItem",
                valueField: "itemID",
                width: 400,
                useLocalDisplayFieldValue: true,
                foreignDisplayField: "itemName"
            }
        ]
    });
    
    isc.ValuesManager.create({
        ID: "testVM",
        dataSource: "largeValueMap_orderItem",
        members: [testForm]
    })
    
    testVM.fetchData({pk: 1}); // extra fetch to retrieve itemName
    //testForm.fetchData({pk:1}); // no extra fetch
    with the largeValueMap_orderItem dataSource (from SQLlargeValueMapSQL sample) modified like this:

    Code:
    <DataSource
        ID="largeValueMap_orderItem"
        serverType="sql"
        tableName="valMapOrderItem"
        testFileName="/examples/shared/ds/serverExamples/test_data/orderItem.data.xml"
    >
        <fields>
            <field name="pk" type="sequence" primaryKey="true" hidden="true" />
            <field name="orderID" type="integer" />
            <field name="orderDate" type="date" />
            <field name="itemID" type="integer" foreignKey="supplyItem.itemID" displayField="supplyItemName" />
            <field name="unitPrice" type="float" />
            <field name="quantity" type="integer" />
            <field name="supplyItemName" type="text" includeFrom="supplyItem.itemName"/>
        </fields>
    </DataSource>
    (the supplyItem dataSource is unchanged)

    You'll see an extra fetch to retrieve the itemName (which is already present in the fetched record as 'supplyItemName').
    Instead, it's working correctly when fetching directly on the form.
    In my application I've got a handful of forms and I call editRecord on the ValuesManager, but I get this same behaviour.
    I hope it isn't by design, as when there are many forms managed by a valuesManager, it's also when this optimization is more useful.
Working...
X