问题
I have a list view with items that contain toggle buttons. I am using the oj-buttonset-many widget to achieve this.
enter image description here
Note that the six buttons are all independent toggle buttons ie. there are 6 button-set-many widgets in each list item.
Now, when I click on these buttons to change states, they work fine. But once I sort / filter the listview, the button states are lost. The underlying values are persisted though.
For ex, lets say the buttons are toggled between [] and [xyz]. A button is toggled and the value becomes [xyz]. Once I sort the list view, the value is still [xyz] but the button loses it's state. So when I click on the button now (the first time), the state is not changed because in the background, the value changes from [xyz] to [] (the value is persisted on sort). When I click on the button the second time, it toggles because the value is now changed to [xyz] and then it works fine. The problem is loss of button state on sorting the list view.
I hope I explained the situation well.
Any help would be appreciated.
Edit 1 :
The html code ::
<oj-buttonset-many value="{{showLocationArray}}" on-value-changed="{{$parent.showLocationMethod}}" display='icons'>
<oj-option data-bind="value: id" >
<span slot='startIcon'><img src="css/images/listofdevices/curr_location.png"></img></span>
<span data-bind="text: $parent.showLocToolTip"></span>
</oj-option>
</oj-buttonset-many>
Regards,
Vikram
来源:https://stackoverflow.com/questions/53444785/oracle-jet-persist-button-set-states-in-list-view-items-models-on-sorting