asynchronous - How to capture removed item in AsyncTypeahead when removing item from the list
问题描述
bootstrap-typeahead for add multiple items to a list.
https://github.com/ericgio/react-bootstrap-typeahead
I need to pick the value, when I remove an item from the list. onChange event of the AsyncTypeahead handling the event when removing and adding items to the list.
When an item removed, selected data updating with the existing values in the list.
Eg: I have 3 items in the list, I am removing an item, Then the selected list containing existing items. (2 items)
In my project I want to get that removed item, at the time of removing.
Is there any functionality for pick that removed value in "onChange" event.
解决方案
我遇到了同样的问题,我以这种方式对其进行了排序:
将您当前选择的项目与您之前选择的项目进行比较onchange
。例如:
const removedItem = this.state.alradySelectedItems.filter(value => !selected.includes(value));
推荐阅读
- svg - 如何将路径数据标准化为 0 x 0 坐标空间?
- android - 对象作为反应子对象无效(找到带有键 {$$typeof type key ref props _owner, _store} 的对象)。
- android - Android - 设置 Google Play 服务和 Firebase - Gradle 构建错误
- ms-access - 访问日期比较不适用于特定日期
- c# - 如何在 POST 操作期间从模型中的 System.Object 属性中检索数据?
- redirect - 缺少参数的烧瓶返回重定向(url_for)错误
- tree - Maxima 是否具有 Mathematica 完整形式的等效函数,用于映射表达式树?
- linux - 当我以标准用户身份运行时,我可以将 lshw 警告传送到 /dev/null 吗?
- typescript - Typescript 没有深入代码分析 getter 函数的返回值
- vba - “此键已与此集合的元素相关联”和运行时错误 457