Announcement

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

    summaryRow seems to ignore implicitCriteria


    SmartClient Version: SNAPSHOT_v12.1d_2019-07-20/Enterprise Development Only (built 2019-07-20)

    Chrome on OSX

    Hello, please try this test case (a modified version of the fetchOperationFS sample):
    Code:
    isc.ListGrid.create({
        ID:"dsListGrid", 
        width: "100%",
        height: "100%",
        autoFetchData: true,
        dataSource: "supplyItem",
        showGridSummary:true,
        summaryRowDataSource:"supplyItem",
        summaryRowFetchRequestProperties:{operationId:"test"},
        implicitCriteria:{units:"Ea"} 
    });
    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>
            <operationBinding operationType="fetch" operationId="test" >
                <summaryFunctions>
                    <SKU>count</SKU>
                </summaryFunctions>
            </operationBinding>
    </DataSource>
    You'll see that the summaryRow fetch ignores the implicitCriteria.

    By the way, it would be handy to have a sample using summaryRowDataSource in the showcase.

    #2
    Although in this case you've provided the same DataSource, in general, the summaryRowDataSource may be a different DataSource, we don't know if the criteria would apply.

    For the same reason, we don't apply implicitCriteria to other DataSources you may configure, such as optionDataSources, which may also happen to be the same as the grid's main DataSource.

    Comment


      #3
      I thought it was fine because the docs for summaryRowCriteria say "If unset, and any filter criteria have been specified for the grid, they will be used."

      It's not entirely clear for me why the summaryRow would use the grid's criteria but not the grid's implicitCriteria.

      Also, if the dataSource is different (I've never done it), isn't it true that also the grid's filter criteria may not apply?

      Comment


        #4
        Also there's a bug/inefficiency: using the test case, if I execute a fetchData with a new criteria, ie:
        dsListGrid.fetchData({units:"Set"})
        and then
        dsListGrid.fetchData({units:"Box"})
        etc...every time I see two fetches for the summaryRow, one with the old criteria, and another with the new criteria.

        Comment


          #5
          Two fetches would be expected with this series.

          Are you saying there are 3 fetches, due to 2 fetches on the latter criteria change?

          Comment


            #6
            Yes, 2 fetches for every fetchData with new criteria

            Comment


              #7
              Originally posted by claudiobosticco View Post
              Yes, 2 fetches for every fetchData with new criteria
              one fetch on the grid, and 2 fetches on the summary row, the first with the old criteria, and the second with the new criteria

              Comment


                #8
                For us it only happens sporadically, but we are able to reproduce it. We're looking into a solution.

                Comment


                  #9
                  We've resolved this problem back to SC 10.1p. There was an issue with today's nightly builds, but the fix will be in the next nightly builds dated 2019-08-07.

                  Comment


                    #10
                    Thanks, I'll try it. Any comments about post #3 ?

                    Comment


                      #11
                      The normal criteria include criteria coming from the filterEditor, so those *must* be applied and must be applicable to the summaryRowDataSource, since the summary row is supposed to change to reflect user filtering. If your summaryRowDataSource can’t handle the filterEditor criteria, it must be broken.

                      It’s not as clear with implicitCriteria as the end user can’t edit it. It could have other purposes and we can’t assume it’s applicable to the summaryRowDataSource.

                      Another possibility would be trimming criteria to just the fields that the end user is allowed to filter on. But that’s more complex yet, especially when considering AdvancedCriteria and nesting, and so is tricky to explain and to understand.

                      We do agree true that there’s ambiguity in the design decision here, which is an argument to leave it as is, since there isn’t a clearly better behavior.

                      Comment

                      Working...
                      X