Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下,怎么删除嵌套分组中的第三级Item? #313

Closed
xiaotian317 opened this issue Dec 22, 2022 · 6 comments
Closed

请问下,怎么删除嵌套分组中的第三级Item? #313

xiaotian317 opened this issue Dec 22, 2022 · 6 comments
Labels
寻求帮助 Extra attention is needed

Comments

@xiaotian317
Copy link

问题描述

期望行为

如何复现

任何业务相关问题没有fork仓库复现问题一律无法解决, 凭空猜测只会让问题晦涩难懂, 大量耽误项目维护时间

截图

异常堆栈信息或者手机截图/视频(拖拽到输入框即可上传)

版本

  • BRV:
  • Android:
  • Gradle:
  • Android Studio:
@xiaotian317 xiaotian317 added the 寻求帮助 Extra attention is needed label Dec 22, 2022
@liangjingkanji
Copy link
Owner

嵌套分组就是多类型item, 根据layoutPosition删除即可, 不过注意itemSublist同步删除数据

@xiaotian317
Copy link
Author

嵌套分组就是多类型item, 根据layoutPosition删除即可, 不过注意itemSublist同步删除数据

感谢回复,请问删除itemSublist的方式这样可以吗?
一:通过getModel()获取到第三级的实体
二:通过遍历models删除获取的GroupBasicModel,生成一个新的models
三: 给适配器设置setDifferModels

如果不可以,还请帮忙指导下,谢谢

@liangjingkanji
Copy link
Owner

可以的, 最近我比较忙碌没有及时回复抱歉, 建议使用models而不是过度依赖setDiffModels()

请自己优先尝试

@xiaotian317
Copy link
Author

xiaotian317 commented Dec 26, 2022

好的,因为对kotlin才刚刚开始学着使用,所以排查起来有些困难,实在是打扰了,我尝试以下方式删除第三级数据,会出现被删除的第三级item跑到第二级去了,不知道是哪里出问题了

var _data =rv?.bindingAdapter?._data as MutableList<GroupModel>
_data.get(0).jsonSublist.get(0).jsonSublist.removeAt(0)
rv?.models=_data
notifyDataSetChanged()

liangjingkanji added a commit that referenced this issue Dec 27, 2022
@liangjingkanji
Copy link
Owner

liangjingkanji commented Dec 27, 2022

已添加嵌套分组删除示例代码, 请查看下面显示的提交内容

liangjingkanji added a commit that referenced this issue Dec 27, 2022
@xiaotian317
Copy link
Author

好的,十分感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
寻求帮助 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants