Example #1
0
Edit = function (document, type/*, options*/) {
	var options = arguments[2];
	this.type = type;
	options = resolveOptions(options, type);
	if (options.render) this._render = callable(options.render);
	DOMComposite.call(this, document, type, options);
	if (options.render) delete this._render;
	this.objInput = this.dom.appendChild(this.make('input', { type: 'hidden' }));
	exclude.call(this.objInput);
};
Example #2
0
	value: d.gs(function () { return this.inputValue; }, function (value) {
		var obj;
		if (value === undefined) value = null;
		if (this.obj === value) return;
		obj = value || this.type.prototype;
		forEach(this.items, function (oldInput, name) {
			var nuInput, observable = obj._get(name);
			oldInput.destroy();
			nuInput = observable.toDOMInput(this.document,
				this.getOptions(observable.descriptor));
			replace.call(oldInput.dom, nuInput.dom);
			if (!value) nuInput.name = this.name + '.' + name;
			this.addItem(nuInput, name);
		}, this);
		if (value && !isNested(value)) {
			this.objInput.setAttribute('value', value.__id__);
			include.call(this.objInput);
		} else {
			this.objInput.removeAttribute('value');
			exclude.call(this.objInput);
		}
		this.obj = value;
		this.name = this._name;
	})