ListView Selection - setState
See original GitHub issueCategory
[ ] Enhancement
[X ] Bug
[ ] Question
Version
Please specify what version of the library you are using: [v2.4.0]
Expected / Desired Behavior / Question
Expecting selection icons to hold state
Observed Behavior
On selection - calling setState in _getSelection re-renders the selection icons - so they don’t show up as selected - ant cannot be selected again
Steps to Reproduce
Same issue as #11
private _getSelection = (items: any[]) => {
console.log('Selected items:', items);
this.setState({
selected: true,
});
}
<ListView
key={'main'}
items={this.state.items}
viewFields={viewFields}
compact={true}
selectionMode={SelectionMode.multiple}
selection={this._getSelection}
showFilter={true}
filterPlaceHolder="Search Policies..."
dragDropFiles={true}
onDrop={this._getDropFiles}
stickyHeader={true} />
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
flutter - Set state for a button in a ListView - Stack Overflow
The plan is to use a loop to create one of these buttons for each of the necessary selection options and then feed...
Read more >Flutter Select Only Item from List | setState() - YouTube
You will learn how to select only one item from the list. You will use setState to do that. This could be done...
Read more >How to Get selected items from ListView in React ... - Syncfusion
Single or many items can be selected by users in the ListView component. An API is used to get selected items from the...
Read more >SetState - - PowerScript Reference - Appeon Documentation
Sets the highlighted state of an item in a list box. SetState is only applicable to a list box control whose MultiSelect property...
Read more >Flutter - "setState() or markNeedsBuild() called during build ...
[Solved]-Flutter - "setState() or markNeedsBuild() called during build" while selecting item from listview-Flutter · Related Query · More Query from same tag.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the late reply, I can confirm updating to the beta fixed the issue.
Hi @jaxnz,
I cannot reproduce the issue using the code you’ve provided. listview-selection.zip
If you are controlling the items/selection state from your component you can also try beta version as we were recently fixing some issues with
ListView
selection.