diff --git a/widgets/form/form.go b/widgets/form/form.go index 963d07cc42..656d0a6387 100644 --- a/widgets/form/form.go +++ b/widgets/form/form.go @@ -218,10 +218,6 @@ func MustGet(form interface{}) *DSL { // Xgen trans to xgen setting func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map[string]interface{}, error) { - if dsl.Config == nil { - dsl.Config = map[string]interface{}{} - } - if dsl.Layout == nil { dsl.Layout = &LayoutDSL{Form: &ViewLayoutDSL{}} } @@ -245,6 +241,13 @@ func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map dsl.Config["full"] = true } + // Merge the layout config + if layout.Config != nil { + for key, value := range layout.Config { + dsl.Config[key] = value + } + } + setting := map[string]interface{}{} bytes, err := jsoniter.Marshal(layout) if err != nil { diff --git a/widgets/table/table.go b/widgets/table/table.go index b2145c4643..ab20dad53c 100644 --- a/widgets/table/table.go +++ b/widgets/table/table.go @@ -277,6 +277,13 @@ func (dsl *DSL) Xgen(data map[string]interface{}, excludes map[string]bool) (map dsl.Config["full"] = true } + // Merge the layout config + if layout.Config != nil { + for key, value := range layout.Config { + dsl.Config[key] = value + } + } + setting := map[string]interface{}{} bytes, err := jsoniter.Marshal(layout) if err != nil { diff --git a/widgets/table/types.go b/widgets/table/types.go index db6626b07d..3374b6cfc0 100644 --- a/widgets/table/types.go +++ b/widgets/table/types.go @@ -80,10 +80,11 @@ type BindActionDSL struct { // LayoutDSL the table layout type LayoutDSL struct { - Primary string `json:"primary,omitempty"` - Header *HeaderLayoutDSL `json:"header,omitempty"` - Filter *FilterLayoutDSL `json:"filter,omitempty"` - Table *ViewLayoutDSL `json:"table,omitempty"` + Primary string `json:"primary,omitempty"` + Header *HeaderLayoutDSL `json:"header,omitempty"` + Filter *FilterLayoutDSL `json:"filter,omitempty"` + Table *ViewLayoutDSL `json:"table,omitempty"` + Config map[string]interface{} `json:"config,omitempty"` } // HeaderLayoutDSL layout.header