Message-ID: <1976794809.12950.1711644320250.JavaMail.appbox@confluence> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_12949_1252884517.1711644320250" ------=_Part_12949_1252884517.1711644320250 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
ColumnOption class represents a single column configuration parameter. <= /p>
=20It needs to be subclassed for particular column type implementation and = passed as return value in ColumnConfigurator.getOptions()= method.
=20Options are displayed in column configuration dialog one after another w= ith labels on the left and inputs on the right.
=20Example
=20var api =3D window.almworks.structure.api; var MyOption1 =3D api.subClass('MyOption', api.ColumnOption, { title: 'Some option', init: function() { this.input$ =3D null; }, createInput: function(div$) { this.input$ =3D div$.append('<input type=3D"text" class=3D"text">= ').find('input'); var params =3D this.spec.params; this.input$.on('change', function() { if (params.someOptionAvaiable) { params.someOption =3D $(this).val(); div$.trigger('notify'); } }); }, notify: function() { var available =3D this.spec.params.someOptionAvaiable; this.input$.val(available ? (this.spec.params.someOption || '42') : '')= ; return available; } });=20
title
If set, title is displayed as a label to the left of the input controls.= Option title representation may be overridden in #createLabel(div$) method.
=20You need to override the following methods.
=20createInput(div$)
Should be overridden to provide custom HTML for the option input. =
div$
parameter provides parent option element to append your view to=
. Created input should trigger 'notify'
event on div$ to notify Structure of any column parameters change.
Please honor the AUI Forms HTML layout when creating your input = controls!
=20Example
=20createInput: function(div$) { var self =3D this; this.input$ =3D $('<input type=3D"text" class=3D"text">').appendTo(= div$).on('change', function() { if (self.spec.params.myOption !=3D=3D $(this).val()) { self.spec.params.myOption =3D $(this).val(); div$.trigger('notify'); } }); }=20
init(options)
Optional initializer.
=20createLabel(div$)
May be overridden to provide custom HTML view for the input label. div$
parameter provides parent option element to append your view t=
o. By default creates a right-aligned label with text of the #title property.
Please honor the AUI Forms HTML layout if you override this meth= od!
=20notify()
This method is called when the column configuration has changed. The imp=
lementation may want to update its controls to reflect those changes. The m=
ethod should return a boolean
indicating whether this option i=
s available. Unavailable options will not be shown on the configuration pan=
el. The default implementation does nothing and always returns true=
code>.
Example
=20notify: function() { this.input$.val(this.spec.params.myOption); return true; }=20
isInputValid()
Returns true
if the current column specification is valid f=
rom the point of view of this option. The column configuration won't be sav=
ed unless all of the options approve the specification. The default impleme=
ntation does nothing and returns true
.
Example
=20isInputValid: function() { // Check that the "field" specification parameter is present. return !!this.spec.params.field; }=20