select2

package
v0.0.0-...-fab95c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Select2GenericAjaxData

func Select2GenericAjaxData(this js.Value, args []js.Value) interface{}

Select2GenericAjaxData returns the most common request parameters for select2 as defined https://select2.org/data-sources/ajax#request-parameters

func Select2GenericAjaxProcessResults

func Select2GenericAjaxProcessResults(select2ResultAble Select2ResultAble) func(this js.Value, args []js.Value) interface{}

func Select2GenericCreateTag

func Select2GenericCreateTag(select2ItemAble Select2ItemAble) func(this js.Value, args []js.Value) interface{}

func Select2GenericTemplateResults

func Select2GenericTemplateResults(select2ItemAble Select2ItemAble) func(this js.Value, args []js.Value) interface{}

Types

type FakeItem

type FakeItem struct {
	Id   int    `json:"id"`
	Text string `json:"text"`
}

func (FakeItem) FromJsJSONValue

func (f FakeItem) FromJsJSONValue(jsvalue js.Value) Select2ItemAble

func (FakeItem) GetSelect2Id

func (f FakeItem) GetSelect2Id() int

func (FakeItem) GetSelect2Text

func (f FakeItem) GetSelect2Text() string

type Select2

type Select2 struct {
	jquery.Jquery
	// contains filtered or unexported fields
}

func NewSelect2

func NewSelect2(jq jquery.Jquery, config *Select2Config) Select2

func (Select2) Select2AppendOption

func (s Select2) Select2AppendOption(o interface{})

func (Select2) Select2Clear

func (s Select2) Select2Clear()

func (Select2) Select2Data

func (s Select2) Select2Data() []Select2Item

func (Select2) Select2IsInitialized

func (s Select2) Select2IsInitialized() bool

func (Select2) Select2ify

func (s Select2) Select2ify()

type Select2Ajax

type Select2Ajax struct {
	URL            string      `json:"url"`
	DataType       string      `json:"datatype"`
	Data           interface{} `json:"data"`
	ProcessResults interface{} `json:"processResults"`
}

Select2Ajax is a select2 ajax request as defined https://select2.org/data-sources/ajax

type Select2Config

type Select2Config struct {
	Placeholder       string      `json:"placeholder"`
	AllowClear        bool        `json:"allowClear"`
	Tags              bool        `json:"tags"`
	Ajax              Select2Ajax `json:"ajax"`
	TemplateResult    interface{} `json:"templateResult,omitempty"`
	TemplateSelection interface{} `json:"templateSelection,omitempty"`
	CreateTag         interface{} `json:"createTag,omitempty"`
}

Select2Config is a select2 parameters struct as defined https://select2.org/configuration

type Select2Data

type Select2Data struct {
	// Results    []Select2Item     `json:"results"`
	Results    []Select2ItemAble `json:"results"`
	Pagination Select2Pagination `json:"pagination"`
}

Select2Data is a select2 data struct as defined https://select2.org/data-sources/formats

func (Select2Data) ToJsValue

func (s Select2Data) ToJsValue() js.Value

type Select2Item

type Select2Item struct {
	Id   string `json:"id"`
	Text string `json:"text"`
}

func Select2ItemFromJsJSONValue

func Select2ItemFromJsJSONValue(jsvalue js.Value) Select2Item

func (Select2Item) IDIsDigit

func (s Select2Item) IDIsDigit() bool

func (Select2Item) IsEmpty

func (s Select2Item) IsEmpty() bool

func (Select2Item) ToJsValue

func (s Select2Item) ToJsValue() js.Value

func (*Select2Item) UnmarshalJSON

func (s *Select2Item) UnmarshalJSON(data []byte) error

type Select2ItemAble

type Select2ItemAble interface {
	GetSelect2Id() int
	GetSelect2Text() string
	FromJsJSONValue(js.Value) Select2ItemAble
}

type Select2Pagination

type Select2Pagination struct {
	More bool `json:"more"`
}

type Select2ResultAble

type Select2ResultAble interface {
	FromJsJSONValue(js.Value) Select2ResultAble
	GetRows() []Select2ItemAble
	GetRowConcreteTypeName() string
	GetTotal() int
	IsExactMatch() bool
}

select2.Select2ResultAble represents a type that can fill in select2 data as defined https://select2.org/data-sources/ajax#transforming-response-data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL