st-descending-first only support "true"
mdarveau opened this issue · comments
Angular 1.6.4
Smart-table 2.1.9
Hi,
The st-descending-first
attribute does not accept the value false
. The descending first behavior is activated on the presence of the attribute and the value itself does not matter. Maybe this is by design, but it was unexpected.
In my case, ordering is dynamic as columns are generated from an array and some columns should descending first while other shouldn't. I tried to st-descending-first="{{col.sort=='DESC'?true:false}}"
and the descending first was always applied.
If anyone has the same issue, there is a workaround using ng-attr-st-descending-first="{{col.sort=='DESC'?true:undefined}}"
Feel free to close if this is the expected behavior. Also worth noting that st-descending-first
is not documented.
I actually wish to align the behavior to regular HTML boolean attributes
It implies indeed that my-attribute="whatever" (could be true or false) should be considered as "true"
I still find this to be counter-intuitive in the context of angular/dynamic binding of properties, but I respect that this is a design decision. Thanks!