Primefaces
This is version . It is not the current version, and thus it cannot be edited.
Back to current version   Restore this version

Primefaces Buttons#

Beim Verwenden von Primefaces werden <h:inputCommand> und native HTML-Buttons nicht im Primefaces-Style dargestellt. Folgendes JavaScript korrigiert dies für Primefaces 3.3:
function init() {
	var inputs = document.getElementsByTagName("input");
	for (var i = 0; i < inputs.length; ++i) {
		var input = inputs[i];
		if ((input.type === 'submit' || input.type === 'button') && typeof input.classNameBase == 'undefined') {
			input.classNameBase = input.className +
				" ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-button-text";
			input.className = input.classNameBase;
			input.addEventListener("mouseover", onmouseover, false);
			input.addEventListener("mouseout", onmouseout, false);
		}
	}
}

function onmouseout(event) {
	event.target.className = event.target.classNameBase;
}
function onmouseover(event) {
	event.target.className = event.target.classNameBase + " ui-state-hover";
}

document.body.addEventListener("load", init, true);

function initAjax(data) {
	if (data.status == 'success')
		init();
}

jsf.ajax.addOnEvent(initAjax);