Classes (0) | Namespaces (0) |
Properties (0) | Static properties (0) |
Methods (0) | Static methods (5) |
Events (0) |
Properties (0) | Static properties (0) |
Methods (0) | Static methods (5) |
Events (0) |
Model object for input types which are available to fields (assigned to Editor.fieldTypes). Any plug-ins which add additional input types to Editor must implement the methods in this object (dummy functions are given in the model so they can be used as defaults if extending this object).
All functions in the model are executed in the Editor's instance scope, so you have full access to the settings object and the API methods if required.
// Add a simple text input (the 'text' type that is built into Editor // does this, so you wouldn't implement this exactly as show, but it // it is a good example. var Editor = $.fn.Editor; Editor.fieldTypes.myInput = $.extend( true, {}, Editor.models.type, { "create": function ( conf ) { // We store the 'input' element in the configuration object so // we can easily access it again in future. conf._input = document.createElement('input'); conf._input.id = conf.id; return conf._input; }, "get": function ( conf ) { return conf._input.value; }, "set": function ( conf, val ) { conf._input.value = val; }, "enable": function ( conf ) { conf._input.disabled = false; }, "disable": function ( conf ) { conf._input.disabled = true; } } );
Create the field - this is called when the field is added to the form.
Note that this is called at initialisation time, or when the
Editor#add API method is called, not when the form is displayed.
If you need to know when the form is shown, you can use the API to listen
for the onOpen
event.
Disable the field - i.e. disallow user interface
Enable the field - i.e. allow user interface
Get the value from the field
Set the value for a field
Create the field - this is called when the field is added to the form.
Note that this is called at initialisation time, or when the
Editor#add API method is called, not when the form is displayed.
If you need to know when the form is shown, you can use the API to listen
for the onOpen
event.
Name | Type | Attributes | Default | Description | |
---|---|---|---|---|---|
1 | conf | object | The configuration object for the field in question: Editor.models.field. |
The input element (or a wrapping element if a more complex input is required) or null if nothing is to be added to the DOM for this input type.
Disable the field - i.e. disallow user interface
Name | Type | Attributes | Default | Description | |
---|---|---|---|---|---|
1 | conf | object | The configuration object for the field in question: Editor.models.field. |
Enable the field - i.e. allow user interface
Name | Type | Attributes | Default | Description | |
---|---|---|---|---|---|
1 | conf | object | The configuration object for the field in question: Editor.models.field. |
Get the value from the field
Name | Type | Attributes | Default | Description | |
---|---|---|---|---|---|
1 | conf | object | The configuration object for the field in question: Editor.models.field. |
The value from the field - the exact value will depend on the formatting required by the input type control.
Set the value for a field
Name | Type | Attributes | Default | Description | |
---|---|---|---|---|---|
1 | conf | object | The configuration object for the field in question: Editor.models.field. | ||
2 | val | * | The value to set the field to - the exact value will depend on the formatting required by the input type control. |