Announcement

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

    formItems and rule context

    Hello, in a databound DynamicForm, I noticed that if I want to use a field (present in the DataSource) in a *when rule or in dynamicCriteria, it must be declared in the fields (hidden, as I don't want it to be visible).

    I would like to ask if this is expected before trying to put together a test case.

    #2
    If this is the same as https://forums.smartclient.com/forum...and-when-rules then that was fixed in builds starting on Sept 14. If not, please provide additional details.

    Comment


      #3
      SmartClient Version: SNAPSHOT_v13.1d_2024-10-17/AllModules Development Only (built 2024-10-17)

      Thanks for the heads up, I forgot about that fix!

      But this time it's a little different, please try this test case in the fetchOperationFS sample:

      Code:
      isc.ListGrid.create({
          ID: "dsListGrid",
          width: "100%",
          height: "100%",
          autoFetchData: true,
          dataSource: "supplyItem",
          recordClick: "editForm.editNewRecord({category:record.category});testWindow.show();"
      });
      
      isc.DynamicForm.create({
          ID: "editForm",
          autoDraw: false,
          fields: [
              //{name: "category", hidden: true},
              {
                  name: "testItem",
                  editorType: "ComboBoxItem",
                  valueField: "SKU",
                  filterFields: ["SKU", "itemName", "description"],
                  pickListFields: [
                      {name: "SKU"},
                      {name: "itemName"},
                      {name: "description"}
                  ],
                  optionDataSource: "supplyItem",
                  optionCriteria: {
                      fieldName: "category",
                      operator: "equals",
                      valuePath: "editForm.values.category"
                  }
              }
          ]
      });
      
      isc.Window.create({
          ID: "testWindow",
          autoDraw: false,
          autoCenter: true,
          isModal: true,
          width: 400,
          height: 200,
          items: [editForm]
      })
      - click a record, and the Window will show
      - open the pickList, you'll see a fetch without a value for the criterion, like:
      Code:
      data:{
              fieldName:"category",
              operator:"equals",
              valuePath:"editForm.values.category"
          },
      - close the Window and click another (or the same) record
      - open the pickList, this time you'll see a fetch with the correct criterion, like:
      Code:
       data:{
              fieldName:"category",
              operator:"equals",
              valuePath:"editForm.values.category",
              value:"Adding Machine/calculator Roll"
          },
      if you uncomment the category formItem, then it'll work right away.

      Comment


        #4
        Well, it seems an easy fix by calling testWindow.show() *before* editForm.editNewRecord(), but maybe it should work in both ways?

        Comment


          #5
          Thanks again for the sample to reproduce the issue. RuleScope is determined during component draw so the first call to editNewRecord() occurs before there is ruleScope. Thus the values are not provided to ruleContext at that point and not picked up by rule criteria. Drawing the form first does work around that issue.

          However, there is no reason we cannot catch this situation and make sure the values are provided to ruleContext after draw. That change has been made and will be available 13.1 builds starting on Oct 19.

          Comment


            #6
            SmartClient Version: SNAPSHOT_v13.1d_2024-10-26/AllModules Development Only (built 2024-10-26)

            Hello, I see this is fixed, thank you very much

            Comment

            Working...
            X