Simple Checkbox Set Selector - default sorting

1
Hi, I'm using the Simple Checkbox Selector for selecting multiple days. (E.g Monday, Wednesday & Friday). My default sorting works by adding an index when creating the days:  Monday  Tuesday   Wednesday Etc. However when I select my values (Monday, Wednesday & Friday), the widget puts the selected values at the top of the list, it turns out like this:  Monday Wednesday Friday Tuesday Thursday My sort order is based on the index but after selecting it uses the selected values first, is there a way around this? I would like my weekdays to keep their sort order, regardless if they are selected or not.  I would like to use this widget because the admin can now add and delete days, I can create the days and use the default input checkbox widget but this makes my solution less flexible.  Thanks in advance!     
asked
5 answers
3

Hi Sjoerd,

You can also try using the Bootstrap Multi Select widget https://appstore.home.mendix.com/link/app/2295/

Regards,

Roel

answered
5

Sjoerd,

 

I'm not too familiar with this widget, but have you tried using the sort attribute? You can add an attribute of type integer, and number the days in the order you would like.

 

 

Edit: try using the data source as microflow, and returning the list the way you want it sorted. A list operation should do the trick.

answered
4

Hi Austin,

Thanks for the reply, that was my first thought as well. I've added an index in order to get the sorting I want:

This works, until I select some items, then it always displays the "checked Items"  first and thereafter it will use the Index again but I want to use the index all the time, regardless if items are checked or not.

answered
4

Please report your issue here: https://github.com/mendix/SimpleCheckboxSetSelector/issues

answered
3

You can edit the widget and disable line 300- 304 like this:

                this._checkboxOptionsArray.sort(function (a, b) {
                //    if (a.checked && !b.checked) {
                //        return -1;
                //    } else if (!a.checked && b.checked) {
                //        return 1;
                //    }
                    return 0;
                });

answered