Options

Attributes

Some of dataTemplates options can be set with attributes.

Methods

Events

Examples

Default

The HTML for an inline advancedSelect, as above.

<select class="advancedSelect">
	<option value="">None</option>
	<option value="1">Left</option>
	<option value="2">Right</option>
</select>

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	blankValue: true,
	templateDir: "/templates/advancedSelect/"
});

If you do not want to allow empty choices the JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	templateDir: "/templates/advancedSelect/"
})

Groups

Inline

The HTML for an inline advancedSelect.

<select class="advancedSelect">
	<option value="">None</option>
	<optgroup value="a" label="Horizontal">
		<option value="1">Left</option>
		<option value="2">Right</option>
	</optgroup>
	<optgroup value="b" label="Vertical">
		<option value="3">Up</option>
		<option value="4">Down</option>
	</optgroup>
</select>

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	blankValue: true,
	templateDir: "/templates/advancedSelect/"
});

JSON Source

With data attribute

The HTML for a JSON data source inline advancedSelect

<select class="advancedSelect" data-ajax-listUrl="jsonSource.json">
</select>

The JSON for a JSON data source, this could also be returned by your server

{"results":[
	{"name":"None","value":""},
	{"name":"Left","value":1},
	{"name":"Right","value":2}
]}

The JSON for a JSON data source for groups, this could also be returned by your server

{"results":[
	{"name":"None","value":"","type":"option","parent":0},
	{"name":"Horizontal","value":"a","type":"optgroup","parent":0},
	{"name":"Left","value":1,"type":"option","parent":"a"},
	{"name":"Right","value":2,"type":"option","parent":"a"},
	{"name":"Vertical","value":"b","type":"optgroup","parent":0},
	{"name":"Up","value":3,"type":"option","parent":"b"},
	{"name":"Down","value":4,"type":"option","parent":"b"}
]}

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	blankVlaue: true,
	templateDir: "/templates/advancedSelect/"
});

If you do not want to allow empty choices the, the JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	templateDir: "/templates/advancedSelect/"
});
Without data attribute

The HTML for a JSON data source advancedSelect

<select class="advancedSelect">
</select>

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	ajax: {listUrl: "jsonSource.json" },
	templateDir: "/templates/advancedSelect/"
});

View extra data on a row

With data attribute

The HTML for a JSON data source inline advancedSelect

<select class="advancedSelect" data-ajax-listUrl="/jsonSource.json" data-ajax-getUrl="/controller/get">
</select>

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	templateDir: "/templates/advancedSelect/",
	viewButton: true
});

The output from the controller should be

{"name":"name","image":"url"}
Without data attribute

The HTML for a JSON data source inline advancedSelect

<select class="advancedSelect">
</select>

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	ajax: {
		listUrl: "jsonSource.json",
		getUrl: "/controller/get"
	},
	templateDir: "/templates/advancedSelect/",
	viewButton: true
});

Themes

Materialize (default)

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	theme: "materialize",
	templateDir: "/templates/advancedSelect/"
});
Bootstrap

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	theme: "bootstrap",
	templateDir: "/templates/advancedSelect/"
});
Custom

The JavaScript initialisation would be:

$('.advancedSelect').advancedSelect({
	theme: "themeFolderName",
	templateDir: "/templates/advancedSelect/"
});

You would then need to add a folder to the themes directory with the following files:

themeFolderName
	inline.html
	modal.html
	row.html
	view.html
			

Please see the supplied theme files for template variable locations