Announcement

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

    select with simple criteria in optionCriteria is sending Advanced criteria in fetch

    Hello, if you test the comboFormDependentSelectsDatabound sample, using the latest 13.0 and 12.1 (2022-11-14) builds, and slightly modified as:

    Code:
    isc.DynamicForm.create({
        top: 25,
        width: 500,
        numCols: 4,
        autoDraw: true,
        fields: [
            {name:"categoryName", title:"Category", editorType:"SelectItem", optionCriteria:{categoryName:"Account Books"},
             optionDataSource:"supplyCategory", changed:"form.clearValue('itemName');"
            }
        ]
    });
    you'll note that the fetch performed for the SelectItem sends an advancedCriteria:

    Code:
    {
        dataSource:"supplyCategory",
        operationType:"fetch",
        componentId:"isc_PickListMenu_0",
        data:{
            operator:"and",
            criteria:[
                {
                    fieldName:"categoryName",
                    operator:"iEquals",
                    value:"Account Books"
                }
            ]
        },
        startRow:0,
        endRow:75,
        textMatchStyle:"startsWith",
        resultSet:[ResultSet ID:isc_ResultSet_1 (dataSource: supplyCategory, created by: isc_PickListMenu_0)],
        callback:{
            caller:[ResultSet ID:isc_ResultSet_1 (dataSource: supplyCategory, created by: isc_PickListMenu_0)],
            methodName:"fetchRemoteDataReply"
        },
        willHandleError:true,
        showPrompt:false,
        prompt:"Finding Records that match your criteria...",
        oldValues:{
            operator:"and",
            criteria:[
                {
                    fieldName:"categoryName",
                    operator:"iEquals",
                    value:"Account Books"
                }
            ]
        },
        requestId:"supplyCategory$6276",
        internalClientContext:{
            requestIndex:1
        },
        fallbackToEval:false,
        componentContext:"isc_DynamicForm_0.categoryName",
        lastClientEventThreadCode:"MUP7",
        bypassCache:true,
        dataProtocol:"getParams"
    }
    I'm pretty sure this was not the case: I was looking to test it with build older 12.1 builds, but it seems not possibile to download builds older than https://smartclient.com/builds/Smart...ise/2022-11-08

    but I tested it with the latest 11.1
    https://www-demos.smartclient.com/sm...lectsDatabound

    and it sends a simple criteria:

    Code:
    {
        dataSource:"supplyCategory",
        operationType:"fetch",
        componentId:"isc_PickListMenu_0",
        data:{
            categoryName:"Account Books"
        },
        startRow:0,
        endRow:75,
        textMatchStyle:"startsWith",
        resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: supplyCategory, created by: isc_PickListMenu_0)],
        callback:{
            caller:[ResultSet ID:isc_ResultSet_0 (dataSource: supplyCategory, created by: isc_PickListMenu_0)],
            methodName:"fetchRemoteDataReply"
        },
        willHandleError:true,
        showPrompt:false,
        prompt:"Finding Records that match your criteria...",
        oldValues:{
            categoryName:"Account Books"
        },
        requestId:"supplyCategory$6274",
        internalClientContext:{
            requestIndex:1
        },
        fallbackToEval:false,
        componentContext:"isc_DynamicForm_0.categoryName",
        lastClientEventThreadCode:"MUP4",
        bypassCache:true,
        dataProtocol:"getParams"
    }

    is it an intended change, or a bug?

    #2
    It's an intended and necessary change, documented here:

    https://smartclient.com/smartclient/...optionCriteria

    Basically the only correct way to combine your optionCriteria with the criteria from the typed-in value in the comboBox is to use AdvancedCriteria, since two different operators are involved.

    Comment


      #3
      Thanks for your quick reply. Actually it'a a SelectItem, so no typed-in value. I see that with textMatchStyle:"exact" it will send a simple criteria (but not if I use optionTextMatchStyle, is this correct?)

      Edit: I just found this in the changelog for the 12.1:
      New Properties to govern how optionCriteria are interpreted in FormItems:
      FormItem.optionTextMatchStyle
      PickList.useOptionTextMatchStyleInPickList

      Backcompat Notes:
      PickList based form items such as SelectItems and ComboBoxItems with optionCriteria specified as a simple criteria object may now generate AdvancedCriteria when fetching pickList options from the optionDataSource. This can be avoided by either setting the optionTextMatchStyle to match the formItem.textMatchStyle attribute, or by setting the 'useOptionTextMatchStyleInPickList' flag to false
      more food for thought for me...for tomorrow :)
      Last edited by claudiobosticco; 14 Nov 2022, 15:08.

      Comment


        #4
        Hello, thanks for pointing me to the relevant docs. After reading this https://smartclient.com/smartclient-...tyleInPickList
        the behaviour seems clear to me.

        And I see that the default textMatchStyle for the selectItem is not "exact", but startsWith (even if it's not possible to type a value), so matching it with optionTextMatchStyle is a way to avoid the AdvancedCriteria (if/when possible)

        Comment

        Working...
        X