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
|
ContentTable components.ContentTable
|
||||||
ContentTabledetail components.ContentTabledetail
|
ContentTabledetail components.ContentTabledetail
|
||||||
ContentGraph components.ContentGraph
|
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
|
// TABLES
|
||||||
// for th head
|
// for th head
|
||||||
var allTh []components.ContentTableTH
|
var allTh []components.ContentTableTH
|
||||||
|
|
@ -725,6 +754,21 @@ func Themecontent(c *core.Context) *core.Response {
|
||||||
|
|
||||||
// now fill data of the components
|
// now fill data of the components
|
||||||
tmplData := templateData{
|
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{
|
ContentTable: components.ContentTable{
|
||||||
ID: "table_demo",
|
ID: "table_demo",
|
||||||
AllTH: allTh,
|
AllTH: allTh,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,9 @@
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<h2>Pie chart</h2>
|
<h2>Pie chart</h2>
|
||||||
{{template "content_graph" .ContentGraph}}
|
{{template "content_graph" .ContentGraph}}
|
||||||
|
<hr>
|
||||||
|
{{template "form_input" .FieldText}}
|
||||||
|
{{template "form_select" .FormSelectCityM}}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
{{template "content_tabledetail" .ContentTabledetail}}
|
{{template "content_tabledetail" .ContentTabledetail}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue