META-INF.resources.primefaces-extensions.dynaform.dynaform.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of primefaces-extensions Show documentation
Show all versions of primefaces-extensions Show documentation
PrimeFaces Extensions components and utilities for PrimeFaces.
/**
* PrimeFaces Extensions DynaForm Widget.
*
* @author Oleg Varaksin
*/
PrimeFaces.widget.ExtDynaForm = PrimeFaces.widget.BaseWidget.extend({
/**
* Initializes the widget.
*
* @param {object} cfg The widget configuration.
*/
init : function(cfg) {
this._super(cfg);
if (!cfg.isPostback) {
this.toggledExtended = false;
}
if (cfg.autoSubmit && !PF(cfg.widgetVar)) {
this.submitForm();
} else if (cfg.isPostback && this.toggledExtended && this.uuid == cfg.uuid) {
var rows = this.jq.find("tr.pe-dynaform-extendedrow");
if (rows.length > 0) {
if (this.openExtended) {
rows.show();
} else {
rows.hide();
}
}
}
this.uuid = cfg.uuid;
},
toggleExtended : function() {
var rows = this.jq.find("tr.pe-dynaform-extendedrow");
if (rows.length > 0) {
rows.toggle();
this.toggledExtended = true;
this.openExtended = $(rows[0]).css("display") != "none";
}
},
submitForm : function() {
this.jq.find(":submit").trigger('click');
}
});