sample code for select multiple and custom attributes in form
This commit is contained in:
parent
7a32380274
commit
368d6c8e6b
2 changed files with 47 additions and 0 deletions
|
|
@ -646,8 +646,37 @@ func Themecontent(c *core.Context) *core.Response {
|
|||
ContentTable components.ContentTable
|
||||
ContentTabledetail components.ContentTabledetail
|
||||
ContentGraph components.ContentGraph
|
||||
FieldText components.FormInput
|
||||
FormSelectCityM components.FormSelect
|
||||
}
|
||||
|
||||
// for select options
|
||||
var allOptions []components.FormSelectOption
|
||||
var option components.FormSelectOption
|
||||
option.Value = "ch"
|
||||
option.Caption = "China"
|
||||
allOptions = append(allOptions, option)
|
||||
option.Value = "ba"
|
||||
option.Caption = "Buenos Aires"
|
||||
allOptions = append(allOptions, option)
|
||||
option.Value = "fr"
|
||||
option.Caption = "France"
|
||||
selectedOption := option
|
||||
allOptions = append(allOptions, option)
|
||||
option.Value = "kr"
|
||||
option.Caption = "Korea"
|
||||
allOptions = append(allOptions, option)
|
||||
|
||||
// for custom attributes in form
|
||||
var customAtt []components.CustomAtt
|
||||
var attribute components.CustomAtt
|
||||
attribute.AttName = "code"
|
||||
attribute.AttValue = "five"
|
||||
customAtt = append(customAtt, attribute)
|
||||
attribute.AttName = "mytag"
|
||||
attribute.AttValue = "My value"
|
||||
customAtt = append(customAtt, attribute)
|
||||
|
||||
// TABLES
|
||||
// for th head
|
||||
var allTh []components.ContentTableTH
|
||||
|
|
@ -725,6 +754,21 @@ func Themecontent(c *core.Context) *core.Response {
|
|||
|
||||
// now fill data of the components
|
||||
tmplData := templateData{
|
||||
FormSelectCityM: components.FormSelect{
|
||||
ID: "city",
|
||||
Label: "Select city",
|
||||
AllOptions: allOptions,
|
||||
SelectedOption: selectedOption,
|
||||
IsMultiple: true,
|
||||
},
|
||||
FieldText: components.FormInput{
|
||||
ID: "text",
|
||||
Label: "Name",
|
||||
Type: "text",
|
||||
Hint: "This is sample hint",
|
||||
Placeholder: "Enter your name",
|
||||
CustomAtt: customAtt,
|
||||
},
|
||||
ContentTable: components.ContentTable{
|
||||
ID: "table_demo",
|
||||
AllTH: allTh,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue