inputEx Documentation
Back to homepage
inputEx Documentation
> TreeField.js
0.2.2
This is the source view for TreeField.js
(function() { var inputEx = YAHOO.inputEx, Event = YAHOO.util.Event, Dom = YAHOO.util.Dom; /** * @class Meta field to create trees * @extends inputEx.ListField * @constructor * @param {Object} options inputEx.Field options object */ inputEx.TreeField = function(options) { inputEx.TreeField.superclass.constructor.call(this, options); }; YAHOO.lang.extend(inputEx.TreeField, inputEx.ListField, /** * @scope inputEx.TreeField.prototype */ { /** * Adds a new line to the List Field * @param {Any} value Value of the subelement * @return {inputEx.Field} instance of the created field (inputEx.Field or derivative) */ renderSubField: function(value) { // Div that wraps the deleteButton + the subField var newDiv = inputEx.cn('div'); // Delete button var delButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-delButton'}); Event.addListener( delButton, 'click', this.onDelete, this, true); newDiv.appendChild( delButton ); var el = new inputEx.TreeField({parentNode: this, elementType: this.options.elementType, value: value }); var subFieldEl = el.getEl(); Dom.setStyle(subFieldEl, 'margin-left', '4px'); Dom.setStyle(subFieldEl, 'float', 'left'); newDiv.appendChild( subFieldEl ); // Subscribe the onChange event to resend it el.updatedEvt.subscribe(this.onChange, this, true); // Line breaker newDiv.appendChild( inputEx.cn('div', null, {clear: "both"}) ); //this.divEl.appendChild(newDiv); this.childContainer.appendChild(newDiv); return el; }, /** * Render the addButton and childContainer */ renderComponent: function() { // Add element button this.addButton = inputEx.cn('img', {src: inputEx.spacerUrl, className: 'inputEx-ListField-addButton'}); Dom.setStyle(this.addButton, 'float', 'left'); this.fieldContainer.appendChild(this.addButton); // Instanciate the new subField this.subField = inputEx.buildField(this.options.elementType); var subFieldEl = this.subField.getEl(); Dom.setStyle(subFieldEl, 'margin-left', '4px'); Dom.setStyle(subFieldEl, 'float', 'left'); this.fieldContainer.appendChild( subFieldEl ); // Line breaker this.fieldContainer.appendChild( inputEx.cn('div', null, {clear: "both"}, this.options.listLabel) ); // Div element to contain the children this.childContainer = inputEx.cn('div', {className: 'inputEx-ListField-childContainer'}); this.fieldContainer.appendChild(this.childContainer); }, /** * Set the value * @param {Any} obj The tree object * @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event) */ setValue: function(obj, sendUpdatedEvt) { this.subField.setValue(obj.value, false); inputEx.TreeField.superclass.setValue.call(this, obj.childValues, sendUpdatedEvt); }, /** * Get the value * @return {Any} The tree object */ getValue: function() { var obj = { value: this.subField.getValue(), childValues: inputEx.TreeField.superclass.getValue.call(this) }; return obj; } }); /** * Register this class as "tree" type */ inputEx.registerType("tree", inputEx.TreeField); })();
Pages
Index
Getting Started
Overview
Markup structure
Migrate from 0.1.0
Field development
DOM functions
Internationalization
Visualization
Examples
Classes
(treeview)
inputEx
inputEx.AutoComplete
inputEx.BirthdateField
inputEx.CheckBox
inputEx.ColorField
inputEx.ColorField2
inputEx.CombineField
inputEx.DateField
inputEx.DatePickerField
inputEx.DateSplitField
inputEx.DateTimeField
inputEx.DSSelectField
inputEx.EmailField
inputEx.Field
inputEx.FileField
inputEx.Form
inputEx.formForMethod
inputEx.FrenchDate
inputEx.FrenchPhone
inputEx.generateServiceForm
inputEx.Group
inputEx.HiddenField
inputEx.ImagemapField
inputEx.InPlaceEdit
inputEx.IntegerField
inputEx.IPv4Field
inputEx.JsonSchema
inputEx.JsonSchema.Builder
inputEx.ListField
inputEx.MapField
inputEx.MenuField
inputEx.MultiAutoComplete
inputEx.MultiSelectField
inputEx.NumberField
inputEx.PairField
inputEx.PasswordField
inputEx.RadioButton
inputEx.RadioField
inputEx.RTEField
inputEx.SelectField
inputEx.SliderField
inputEx.StringField
inputEx.Textarea
inputEx.TimeField
inputEx.TreeField
inputEx.TypeField
inputEx.UneditableField
inputEx.UpperCaseField
inputEx.UrlField
inputEx.VectorField
inputEx.widget
inputEx.widget.DataTable
inputEx.widget.DDList
inputEx.widget.DDListItem
inputEx.widget.Dialog
inputEx.widget.InputExCellEditor
inputEx.widget.JsonTreeInspector
Files
AutoComplete.js
BirthdateField.js
CheckBox.js
ColorField.js
ColorField2.js
CombineField.js
DataTable-beta.js
DateField.js
DatePickerField.js
DateSplitField.js
DateTimeField.js
ddlist.js
Dialog-beta.js
DSSelectField.js
EmailField.js
Field.js
FileField-beta.js
Form.js
fr.js
FrenchDate.js
FrenchPhone.js
Group.js
HiddenField.js
ImagemapField.js
InPlaceEdit.js
inputex-loader.js
inputex-rpc.js
inputex.js
IntegerField.js
IPv4Field.js
it.js
json-schema.js
json-tree-inspector.js
ListField.js
MapField.js
MenuField.js
MultiAutoComplete.js
MultiSelectField.js
NumberField.js
PairField.js
PasswordField.js
RadioButton.js
RadioField.js
RTEField.js
SelectField.js
SliderField.js
StringField.js
Textarea.js
TimeField.js
TreeField.js
TypeField.js
UneditableField.js
UpperCaseField.js
UrlField.js
VectorField.js
Visus.js
Copyright (c) 2007-2009
Eric Abouaf
. All rights reserved.
Generated by
JsDoc Toolkit
2.0.0 on Wed, 04 Mar 2009 15:41:30 GMT using
neyricjslibs-template
.