admin管理员组文章数量:1287969
In ponent of office 365 fabric ReactJs exists such ponent. It has _getSelectionDetails()
method which counts selected items from list
I want to make method which will reset it and will deselect items in list. For example we have button and when we press it, we reset all the items in the list, which we marked before. I tried to do :
_resetSelectedItems() :{
this.setState ({ selectionDetails: 0 })
}
After I call it, it sets new state and sets 0, but items which were selected before remain selected, diselecting doesn't happen. How I can deselect items?
In ponent of office 365 fabric ReactJs exists such ponent. It has _getSelectionDetails()
method which counts selected items from list
I want to make method which will reset it and will deselect items in list. For example we have button and when we press it, we reset all the items in the list, which we marked before. I tried to do :
_resetSelectedItems() :{
this.setState ({ selectionDetails: 0 })
}
After I call it, it sets new state and sets 0, but items which were selected before remain selected, diselecting doesn't happen. How I can deselect items?
Share Improve this question asked Jul 25, 2017 at 12:45 Sam FisherSam Fisher 8482 gold badges15 silver badges37 bronze badges 1- 1 try using this._selection.XXXx , you have full documentation here: github./OfficeDev/office-ui-fabric-react/blob/master/… – José Quinto Zamora Commented Jul 25, 2017 at 12:57
1 Answer
Reset to default 13this.setState()
performs a shallow merge of this.state
into the new state, e.g. if this.state
have selectionDetails
and many more objects. this.setState ({ selectionDetails: 0 })
will update only selectionDetails
other will remain unchange. You have to cleanup other objects manually.
ref : this.setState
Update :
finally i got it.... this._selection.setAllSelected(false)
will work.
check out my github project or check online.
本文标签: javascriptHow to reset selected items from the listStack Overflow
版权声明:本文标题:javascript - How to reset selected items from the list? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741331716a2372802.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论