Announcement

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

    No setSortField on RadioGroupItem

    Is there any way to use a client side option data source with a sort for RadioGroupItem?

    I can specify an option datasource, but there is no way to override the order, it will always order by value.

    SmartClient Version: v12.1p_2023-10-21/Pro Deployment (built 2023-10-21)


    Thanks

    #2
    Hi Isomorphic,
    Any update on this question?
    Thanks

    Comment


      #3
      Hi Stonebranch
      Sorry for the silence - this issue has been seen and is already under investigation. We'll be following up with more information soon

      Regards
      Isomorphic Software

      Comment


        #4
        In your original post you say this:

        I can specify an option datasource, but there is no way to override the order, it will always order by value.
        Are you saying that you have a functional RadioGroupItem deriving its valueMap from an optionDataSource?
        This is confusing to us as the RadioGroupItem class should not currently support this.

        If you do have a functional RadioGroupItem picking up its options from an optionDataSource we'd be interested to see how this is defined in your application code.


        Assuming that this is not the case, the easiest way to achieve what you're after is to explicitly issue a fetch against your target dataSource to pick up the desired set of options and apply them to the item as a valueMap directly.
        (The fetch can be sorted by specifying 'sortBy' on the request properties).
        Here's an example of this approach, given a dataSource "testDS" with two fields "dataField" and "valueField":

        Code:
        testDS.fetchData(
            {},  // optional criteria to restrict the set of options
            function (response, data, request) {
                var valueMap = {};
                for (var record of data) {
                    valueMap[record.dataField] = record.displayField;
                }
                // At this point you have a sorted valueMap you can apply to your item
                testForm.getItem("testItem").setValueMap(valueMap);
            },
            {
                sortBy:"displayField"
            }
        );

        Comment

        Working...
        X