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.

    #2
    Hello, I still see the extra fetch with the latests 13.0 and 13.1

    Comment


      #3
      Hello, any news? Is it an expected behaviour?

      Comment


        #4
        Sorry, this was assigned immediately, but it has taken a while to get to because it's a fiddly area that requires a long stretch of focus to get into and resolve things. Unfortunately, it will be another week (the assignee, who it should definitely stay with, is off camping!).

        The behavior is definitely unexpected. If it's possible, it may resolve it to move the relevant settings (such as useLocalDisplayFieldValue) into the DataSource rather than having them just one the FormIitem.

        Comment

        Working...
        X