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

[Question] Single Select fields doesn't show value in Details screen

Open mohamad-abuzaid opened this issue 11 months ago • 0 comments

Hello all, I have this "users" table. The list shows fine table view.. But when I navigate to Item details screen, the Dropdown fields appear empty. Although they have data.

Here is my current code..


users.go

`func GetUsersTable(ctx *context.Context) table.Table { users := table.NewDefaultTable(ctx, table.DefaultConfigWithDriver("mysql"))

info := users.GetInfo().HideFilterArea()

info.AddField("ID", "id", db.Int).FieldSortable()
info.AddField("Username", "username", db.Varchar).FieldSortable()
info.AddField("Gender", "gender", db.Varchar).
	FieldJoin(types.Join{
		BaseTable: "app_users",
		Field:     "gender_id",
		Table:     "app_genders",
		JoinField: "id",
	})
info.AddField("Points", "points", db.Int).FieldSortable()
info.AddField("Rank", "rank", db.Varchar).
	FieldJoin(types.Join{
		BaseTable: "app_users",
		Field:     "rank_id",
		Table:     "app_ranks",
		JoinField: "id",
	})
info.AddField("Language", "language", db.Varchar).
	FieldJoin(types.Join{
		BaseTable: "app_users",
		Field:     "lang_id",
		Table:     "app_languages",
		JoinField: "id",
	})

info.SetTable("app_users").
	SetTitle("Users").
	SetDescription("Users")

details := users.GetDetail()
details.SetTable("app_users").
	SetTitle("User Details").
	SetDescription("User Details")

....

return users
 }`

Correct View in table list

Image


Error View in Details screen

Image

mohamad-abuzaid avatar Jan 31 '25 13:01 mohamad-abuzaid