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

ColumnOption Class

window.almworks.structure.api.ColumnOption

=20

ColumnOption class represents a single column configuration parameter. <= /p>

=20

It needs to be subclassed for particular column type implementation and = passed as return value in ColumnConfigurator.getOptions()= method.

=20

Options are displayed in column configuration dialog one after another w= ith labels on the left and inputs on the right.

=20

Example

=20
=20
var 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
=20

Properties

=20

title

=20

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.

=20

Required Methods

=20

You need to override the following methods.

=20

createInput(div$)

=20

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.

=20

Please honor the AUI Forms HTML layout when creating your input = controls!

=20

Example

=20
=20
createInput: 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
=20

Other Methods

=20

init(options)

= =20

Optional initializer.

=20

createLabel(div$)

=20

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.

=20

Please honor the AUI Forms HTML layout if you override this meth= od!

=20

notify()

=20

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.

=20

Example

=20
=20
notify: function() {
  this.input$.val(this.spec.params.myOption);
  return true;
}
=20
=20

isInputValid()=20

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.

=20

Example

=20
=20
isInputValid: function() {
  // Check that the "field" specification parameter is present.
  return !!this.spec.params.field;
}
=20

------=_Part_12949_1252884517.1711644320250--