Announcement

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

    sorting omitted after first fetch in pickList

    SmartClient Version: v12.1p_2022-10-18/AllModules Development Only (built 2022-10-18)

    Chrome on MacOS

    Hello, please try the formDependentSelectsDatabound showcase sample modified like this:

    Code:
    isc.DynamicForm.create({
        top: 25,
        width: 500,
        numCols: 4,
        autoDraw: true,
        fields: [
            {name:"categoryName", title:"Category", editorType:"SelectItem",
             pickListProperties:{sortField:"categoryName", sortDirection:"descending"},
             optionDataSource:"supplyCategory", changed:"form.clearValue('itemName');"
            }
        ]
    });
    you'll see in the RPC tab that in the first fetch there's the sortField, but when you scroll down the pickList, the sortField is omitted in the subsequent fetches.

    Same using initialSort.


    #2
    Hi Claudio
    The problem here is that you're applying the sortField / sortDirection directly to the pickList via pickListProperties, but the SelectItem is expecting the sort to be configured directly on the item: https://smartclient.com/smartclient-...Item.sortField

    If you specify sortField / sortDirection directly on the item the problem should go away for you

    Regards
    Isomorphic Software

    Comment


      #3
      Hello, thanks for the clarification, now I see that sortField directly on the item works.

      But as sortField is documented on the PickList interface, now I wonder what could be an actual use case for it.

      Comment


        #4
        Hi Claudio
        I think this is just some confusion about terminology mainly:

        - SelectItem and ComboBoxItem implement the PickList interface. IE they are SmartClient classes with common behavior and configuration attributes (including "sortField", etc) to do with showing a drop down list. The drop down list is implemented as an autoChild called "pickList".

        - The pickList (SelectItem.pickList and ComboBoxItem.pickList) is an autoChild that gets created by the system and is configured both from properties applied to the formItem itself, and the standard autoChild pattern (including properties applied to it directly via "pickListProperties").

        - The pickList autoChild is implemented as a subclass of ListGrid called "PickListMenu" - see the standard autoChild type attribute "SelectItem.pickListConstructor"

        - Since the pickList is a PickListMenu, any properties documented on that class or its ancestor classes including ListGrid can be set directly on selectItem.pickListProperties and they'll be applied to the pickList. This allows you to configure basically any arbitrary listGrid behavior that makes sense on your pickList, as we do when we show the filterEditor on the pickList in this sample: https://smartclient.com/smartclient/...oFilterRelated

        - However - if a property or behavior for the pickList autoChild can be configured on the SelectItem but could also be configured directly directly on a ListGrid, the right way to configure that property is typically on the SelectItem rather than via pickListProperties.

        That's what's happening in this case.

        I hope this is helpful

        Regards
        Isomorphic Software

        Comment


          #5
          Hello, thanks for the explanation, but that "tipically" is bothering my OCD :) as I don't understand how to know if I'm not in the "tipical" scenario from the docs.

          Also, I've verified that sortField in pickListProperties was working in old versions, like:

          SmartClient Version: v12.1p_2022-01-04/Enterprise Development Only (built 2022-01-04)

          I don't know if it's the most recent working...it's just the first I've tried that I already have on my local machine(*)

          And I've just noticed that warning in the chrome console

          12:13:43.775:MUP9:WARN:PickListMenu:isc_PickListMenu_2:fields and completeFields are null and there is no DataSource

          besides that completeFields is not documented, what are the implications of this warning?

          (*)actually I can't download other builds from https://smartclient.com/builds, I get Connection refused from f000.backblazeb2.com. error
          Last edited by claudiobosticco; 25 Oct 2022, 02:45.

          Comment


            #6
            Hi Claudio

            What we were getting at is that if you can configure a formItem's pickList behavior via properties on the item this is the recommended way to perform the configuration, rather than setting properties on the pickList itself via "pickListProperties".

            In some cases this won't have any ill effects (assuming the form-item level config property was unset), but in some cases setting the attribute via pickListProperties is definitely unsupported and unsupportable. To pick an example other than sortField- item pickLists pick up their dataSource from the item's optionDataSource, so you'd never set pickListProperties.dataSource directly.

            This concept is mentioned in the AutoChild documentation (though we will review this to see if we can make it more explicit):
            Passthroughs (eg window.headerStyle)


            In many cases a component will provide shortcuts to skinning or customizing its AutoChildren, such as Window.headerStyle, which becomes header.styleName. When these shortcuts exist, they must be used instead of the more general AutoChild skinning system.
            So setting item.sortField / item.sortDirection is the appropriate way to configure the sort on your pickList and we'd recommend you use this pattern! :)
            --

            We do acknowledge that the fact that this pattern used to work but no longer does is going to be frustrating for anyone who was relying on the former behavior (even though it wasn't best-practice)... and performed an upgrade. We'll look into why this changed and if it's easy to make it work again for the case where formItem.sortField was not explicitly set, we will do so as a convenience for backwards compatibility.

            The warning you mention ("fields and completeFields are null and there is no DataSource") is a ListGrid warning indicating that you've created a ListGrid with no fields and no dataSource. It shouldn't be being tripped from a pickListProperties block (where the grid's fields/dataSource will be configured automatically by the item).

            It's safe to ignore in this usage and we'll look into why it's coming up

            Regards
            Isomorphic Software

            Comment

            Working...
            X