go-admin icon indicating copy to clipboard operation
go-admin copied to clipboard

[Question]如何实现在筛选时多个字段的联动

Open Gowa2017 opened this issue 1 year ago • 1 comments

Description [describe your questions]

比如现在我有一两个概念,

  • 分组
  • 分区,一个分组下有多个分区

但我在进行筛选的时候,我可以使用 AddTableOptions 来从数据库获取到分组信息。但是我无法实现选择了分组的时候自动过滤出分组下的分区信息。

Example code [If you have any code info]

	info.AddField("分组", "gid", db.Int).
		FieldHide().
		FieldFilterable(types.FilterType{FormType: form.SelectSingle}).
		FieldFilterOptionsFromTable("group", "name", "id")
	info.AddField("分区", "zid", db.Int).
        FieldHide().
		FieldFilterable(types.FilterType{FormType: form.SelectSingle}).
		FieldFilterOptionsFromTable("zone", "name", "id")

Others [screenshots or other info]

Gowa2017 avatar Jan 28 '24 03:01 Gowa2017

http://doc.go-admin.cn/zh/admin/form/components/#_4 参考:https://github.com/GoAdminGroup/demo.go-admin.cn/blob/master/tables/user.go#L115

chenhg5 avatar Apr 06 '24 04:04 chenhg5