-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hey Guys
Trying to make conditional Felds.
if something is set on Field A then post a Autosave and Field B should appear.
`
categoryAdmin.RegisterEventFunc("autosave_Type", func(ctx *web.EventContext) (web.EventResponse, error) {
id := ctx.R.FormValue("ID")
var category Category
if err := postgresql.MainPostgresDataBase.Where("id = ?", id).First(&category).Error; err != nil {
return web.EventResponse{}, err
}
newValue := ctx.R.FormValue("Type")
category.Type = newValue
if err := postgresql.MainPostgresDataBase.Save(&category).Error; err != nil {
return web.EventResponse{}, err
}
return web.EventResponse{
// Reload: true,
ReloadPortals: []string{"reload"},
}, nil
})
`
Autosave works fine and i got also a json Response after changing the value:
But the problematic part is this one:
`
categoryAdmin.Editing().Field("Parent").ComponentFunc(
func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) htmlgo.HTMLComponent {
cat, ok := obj.(*Category)
if !ok || cat.Type != "subCategory" {
return nil
}
return web.Portal(
func() htmlgo.HTMLComponent {
if cat.Type != "subCategory" {
return nil // oder ggf. Placeholder
}
return vuetify.VSelect().Label("Parent")
}(),
).Name("reload")
})
`
if i reload manually the mechanism works fine - so the parentfield is just visible it the type is subcategory.
but the problem is nowhere in my dome some kind of portal with my name is visible and it also not refresh on change
Metadata
Metadata
Assignees
Labels
No labels