mendix / EnumSlider

A slider based on your enumeration values
Apache License 2.0
0 stars 1 forks source link

Remaining this.slideEnum array elements depends on the listing order of exceptions ... #1

Closed shott closed 8 years ago

shott commented 9 years ago

Assume an enumeration with keys _A, _B, _C, _D, _E, and _F and captions A, B, C, D, E, and F, respectively and that they are ordered from _A to _F in that order in my definition of the enumeration.

If I want to use EnumSlider, but with the exception of _C, _D, _E, and _F, so that I only have _A and _B in my Enum Slider then it works properly if I use an exception string of "_C,_D,_E,_F". However, if is use any other order in the exception string such as "_C,_D,_F,_E", "_D,_C,_E,_F", or "_F,_E,_D,_C" then the two remaining elements in my slider are NOT _A or _B.

As I understand it, the spliceList[] array is the list of indexes of the enumeration that are to be removed so that for an exception string of "_C,_D,_E,_F" the spliceList array would contain indexes 2, 3, 4, and 5.

For the other 3 conditions that I listed above, however, the spliceList array would contain 2, 3, 5, and 4 (for _C,_D,_F,_E), 3, 2, 4, 5 (for _D,_C,_E,_F), and 5, 4, 3, 2 (for _F,_E,_D,_C).

However, I believe that the for loop that "splices" this.slideEnum with elements of spliceList only works properly if the list of indexes to be removed is ordered in a monotonically increasing order.

I believe that the proper fix for this problem is to sort spliceList in increasing numerical order.

I indent to create a fork named "spliceList fix" to address this issue.