Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

How to toggle itemsSelected on maxSelected #7

Open
Rana-Muhammad-Amir opened this issue Mar 30, 2018 · 2 comments
Open

How to toggle itemsSelected on maxSelected #7

Rana-Muhammad-Amir opened this issue Mar 30, 2018 · 2 comments

Comments

@Rana-Muhammad-Amir
Copy link

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
Copy link

7laria commented Jun 26, 2018

same issue

@7laria
Copy link

7laria commented Aug 3, 2018

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)
  }
})

}`

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants