How to toggle itemsSelected on maxSelected
Opened this issue · 2 comments
Rana-Muhammad-Amir commented
Hey..!
i want to toggle value of this.tag.itemsSelected on selection more than one value.
Simply i mean that if a user select one item and then he selecte the other one the item should automatically toggle and only second value should be selected.
#thanks in advance.....
7laria commented
same issue
7laria commented
i create a workaround changing the handleSelectItem of TabSelect.js
` handleSelectItem = (item) => {
const key = item[this.props.keyAttr] || item
const value = []
const found = this.state.value[key]
// Item is on array, so user is removing the selection
// if (found) {
// delete value[key]
// } else {
// // User is adding but has reached the max number permitted
// if (this.props.max && this.totalSelected >= this.props.max) {
// if (this.props.onMaxError) {
// return this.props.onMaxError()
// }
// }
//
// }
value[key] = item
return this.setState({ value }, () => {
if (this.props.onItemPress) {
this.props.onItemPress(item)
}
})
}`