Announcement

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

    implicitCriteria ignored by TreeGrid

    SmartClient Version: v13.0p_2023-06-12/AllModules Development Only (built 2023-06-12)

    Chrome on MaxOS

    Hello please try the #treeLoadOnDemand sample modified like this:

    Code:
    isc.DynamicForm.create({
        ID: "aForm",
        fields: [
            {
                name: "EmployeeStatus",
                optionDataSource: "employees",
                displayField: "EmployeeStatus",
                valueField: "EmployeeStatus",
                editorType: "SelectItem",
                changed(form, item, value) {
                    var needsFetch = false;
                    if (!employeeTree.data.implicitCriteria) {
                        needsFetch = true;
                    }
                    employeeTree.data.setProperty('implicitCriteria', {EmployeeStatus: value});
                    if (needsFetch) {
                        employeeTree.fetchData();
                    }
                }
            }
        ]
    })
    
    isc.TreeGrid.create({
        ID: "employeeTree",
        top: 100,
        width: 500, height: 300, alternateRecordStyles: true,
        dataSource: "employees",
        fields: [
            {name: "SKU"},
            {name: "Job"},
            {name: "OrgUnit"},
            {name: "EmployeeType"},
            {name: "EmployeeStatus"}
        ],
        showFilterEditor: true,
        filterOnKeypress: true,
        fetchDelay: 500
    });
    if you select different values for the selectItem, you'll see fetches without the implicit criteria.

    Is it a bug, or am I missing something?

    #2
    Yes, that's definitely a bug; a regression in fact - we know this was working recently.

    We're investigating and will update here when we've fixed it.

    Comment


      #3
      hi claudio ,

      Firstly, you should call grid.setImplicitCriteria(), which now exists, rather than setProperty("implicitCriteria", ...). That may fix things for you.

      If not - does the sample you showed closely resemble your use-case?

      We ask because, while it does look like we may have an issue with dataFetchMode "basic", which is the default mode, you should be able to change the sample to add dataFetchMode: "local", and that should fix implicitCriteria. Similarly, "paged" should also work, as-is.

      Please confirm - thanks

      Isomorphic Support

      Comment


        #4
        Hello, calling setImplicitCriteria doesn't seem to make a difference.

        Also, I've always counted on the setProperty method to call the actual setter if it exists, isn't it the case?

        In my actual use case, I've got loadDataOnDemand:false, so a test case like this is closer:

        Code:
        isc.DynamicForm.create({
            ID: "aForm",
            fields: [
                {
                    name: "EmployeeStatus",
                    optionDataSource: "employees",
                    displayField: "EmployeeStatus",
                    valueField: "EmployeeStatus",
                    editorType: "SelectItem",
                    changed(form, item, value) {
                        var needsFetch = false;
                        if (!employeeTree.data.implicitCriteria) {
                            needsFetch = true;
                        }
                        employeeTree.setImplicitCriteria({EmployeeStatus: value});
                        if (needsFetch) {
                            employeeTree.fetchData();
                        }
                    }
                }
            ]
        })
        
        isc.TreeGrid.create({
            ID: "employeeTree",
            top: 100,
            width: 500, height: 300, alternateRecordStyles: true,
            dataSource: "employees",
            dataFetchMode: "local",
            fields: [
                {name: "SKU"},
                {name: "Job"},
                {name: "OrgUnit"},
                {name: "EmployeeType"},
                {name: "EmployeeStatus"}
            ],
            dataProperties: {
                defaultIsFolder: true,
                parentIdField: "ReportsTo",
                idField: "EmployeeId",
                modelType: "parent",
                loadDataOnDemand: false
            }
        });
        But this means I can't use dataFetchMode: "paged".
        Instead, dataFetchMode: "local" works (tested in my application), so I could use it at least as a temporary fix, even if it's less efficient than filtering on the server.

        Comment


          #5
          Yes, you can count on setProperty() to generally execute a setter, if one exists - in this case, though, setImplicitCriteria() has additional parameters which will never be passed by setProperty().

          Thanks for the clarification - we'll take a look at "basic" mode in the next day or two and update here when we have it fixed.

          Comment


            #6
            Thanks for the quick reply and the clarification on setImplicitCriteria!

            Comment


              #7
              And I see that actually the setImplicitCriteria simplifies the code in the changed handler:

              Code:
              ...
                         changed(form, item, value) {
                              employeeTree.setImplicitCriteria({EmployeeStatus: value}, null, true);
                          }
              ....

              Comment


                #8
                We've made a change which should fix implicitCriteria on the default "basic" fetchMode - so your original sample in this thread will work as of tomorrow's builds, dated June 15 and later.

                Comment


                  #9
                  SmartClient Version: v13.0p_2023-06-16/AllModules Development Only (built 2023-06-16)

                  Hello, thank you very much, now it's working, using setImplicitCriteria.

                  Comment

                  Working...
                  X