Announcement

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

    allowMultiUpdate and grid.refreshData()

    Hello, I'm trying to use an operationBinding like this:

    Code:
    <operationBinding operationType="update" operationId="markAllRead" 
                              allowMultiUpdate="true" cacheSyncStrategy="none">
                <criteria fieldName="EMAIL" operator="equals" value="$userId"/>
                <criteria fieldName="IS_READ" operator="equals" value="false"/>
                <values fieldName="IS_READ" value="true"/>
                <script language="groovy">
                    DSResponse dsResponse = dsRequest.execute();
                    dsResponse.setInvalidateCache(false);
                    return dsResponse;
                </script>
            </operationBinding>
    to update all records of a grid as read by a user. I do setInvalidateCache(false) because client side I want to "replace" it with a grid.refreshData() for a better UE.

    What I wasn't expecting is seeing errors in a formatCellValue, because it is called several times and sometimes with the record parameter that contains just:
    Code:
    _recordInvalidationTime_myGrid: ....
    and nothing else.

    Is it a bug or am I doing something not supported?


    #2
    Hello, may I ask if you see the problem or if I'm missing something?

    Comment


      #3
      With a hand-constructed repro case based on your DataSource operation, we see a warning logged by the findByKeys() method when it attempts to apply cache sync updates, but that is to be expected: the reponse is marked invalidateCache: false, so the cache sync subsystem expects there to be response values, but there are none. Your formatCellValue() issue is likely to be related to this conflict between the invalidateCache: flase setting and the lack of response values. If you would like us to investigate this precise issue further, we will need a standalone repro case, including the client logic and DataSource definition, ideally based on one of the sample dataSources like worldDS or Employees

      Comment


        #4
        SmartClient Version: v13.1p_2025-04-01/Enterprise Development Only (built 2025-04-01)

        Hello, this test case took me several attempts. I couldn't figure out what was triggering the issue. Please try this test case:

        Code:
        isc.ListGrid.create({
            ID: "dsListGrid",
            width: 700, height: 400, top: 40,
            fetchOperation: "aFetch",
            canEdit: true,
            dataSource: "supplyItem",
            fields: [
                {
                    name: "SKU", wrap: true,
                    canEdit: false,
                    formatCellValue: function (value, record, rowNum, colNum, grid) {
                        if (!record.itemID)
                            isc.logEcho(record, "rowNum: " + rowNum)
                        return value;
                    }
                },
                {
                    name: "inStock", width: 100
                }
            ],
            autoFetchData: true
        })
        
        isc.IButton.create({
            title: "set in stock",
            click: function () {
                dsListGrid.updateData(
                    {},
                    null,
                    {operationId: "setInStock", showPrompt: false}
                );
            }
        })
        Code:
        <DataSource isSampleDS="true"
            ID="supplyItem"
            serverType="sql"
            tableName="supplyItem"
            titleField="itemName"
            testFileName="/examples/shared/ds/test_data/supplyItem.data.xml"
            dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"
        >
        
            <fields>
                <field name="itemID" type="sequence" hidden="true" primaryKey="true"/>
                <field name="itemName" type="text" title="Item" length="128" required="true"/>
                <field name="SKU" type="text" title="SKU" length="10" required="true"/>
                <field name="description" type="text" title="Description" length="2000"/>
                <field name="category" type="text" title="Category" length="128" required="true"
                       foreignKey="supplyCategory.categoryName"/>
                <field name="units" type="enum" title="Units" length="5">
                    <valueMap>
                        <value>Roll</value>
                        <value>Ea</value>
                        <value>Pkt</value>
                        <value>Set</value>
                        <value>Tube</value>
                        <value>Pad</value>
                        <value>Ream</value>
                        <value>Tin</value>
                        <value>Bag</value>
                        <value>Ctn</value>
                        <value>Box</value>
                    </valueMap>
                </field>
                <field name="unitCost" type="float" title="Unit Cost" required="true">
                    <validators>
                        <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost"/>
                        <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2"/>
                    </validators>
                </field>
                <field name="inStock" type="boolean" title="In Stock"/>
                <field name="nextShipment" type="date" title="Next Shipment"/>
            </fields>
        
            <operationBindings>
                <operationBinding operationType="fetch" operationId="aFetch">
                    <criteria fieldName="category" operator="equals" value="Accessories"/>
                </operationBinding>
        
                <operationBinding operationType="update" operationId="setInStock"
                                  allowMultiUpdate="true" cacheSyncStrategy="none">
                    <criteria fieldName="category" operator="equals" value="Super Glue"/>
                    <criteria fieldName="inStock" operator="equals" value="false"/>
                    <values fieldName="inStock" value="true"/>
                    <script language="groovy">
                        DSResponse dsResponse = dsRequest.execute();
                        dsResponse.setInvalidateCache(false);
                        return dsResponse;
                    </script>
                </operationBinding>
            </operationBindings>
        </DataSource>
        then, press "set in stock" and/or click to edit the boolean value, and you'll see logs like:

        Code:
        *18:06:57.228:XRP2:WARN:Log:rowNum: 25: {_recordInvalidationTime_dsListGrid: 1743610012207.004}
        strangely enough, the <criteria> in the fetch <operationBinding> seems to be the culprit

        Comment


          #5
          Hello, any news about this issue?

          Comment


            #6
            Hi,
            just a quick follow-up: any thoughts on this?
            Thanks in advance!

            Comment


              #7
              Sorry for the delay. We did fix this issue back in April on our main development branch, but the fix didn't get backported. This has now been done, and the fix will be present in tomorrow's builds of 13.1 and later (those dated May 29th). The framework will now log a message saying that it unexpectedly got empty results (because it did - setting invalidateCache: false causes that), rather than dropping into cache sync with an empty dataset, which was causing mysterious downstream messages.

              Please try tomorrow's build and let us know

              Comment


                #8
                SmartClient Version: v13.1p_2025-05-29/Enterprise Deployment (built 2025-05-29)

                Hello, I can confirm it's fixed, thank you very much

                Comment

                Working...
                X