summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/devicemanager/provider/src/test/resources/elasticsearch/plugins/head/src/app/ui/checkField/checkField.js
blob: d5f50127e68f1aa97f82c7ea0e6884fcaf9c415e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(function( app ) {

	var ui = app.ns("ui");

	ui.CheckField = ui.AbstractField.extend({
		_main_template: function() { return (
			{ tag: "DIV", id: this.id(), cls: "uiCheckField", children: [
				{ tag: "INPUT", type: "checkbox", name: this.config.name, checked: !!this.config.value }
			] }
		); },
		validate: function() {
			return this.val() || ( ! this.require );
		},
		val: function( val ) {
			if( val === undefined ) {
				return !!this.field.attr( "checked" );
			} else {
				this.field.attr( "checked", !!val );
			}
		}
	});

})( this.app );