我找到解決方案表示感謝。
我們需要從
//update step status
if($this.cfg.showStepStatus) {
$this.stepControls.removeClass('ui-state-highlight');
$($this.stepControls.get(currentStepIndex)).addClass('ui-state-highlight');
}
覆蓋loadStep的功能PrimeFaces.widget.Wizard.prototype
我改變oryginal一段代碼
到
//update step status
if ($this.cfg.showStepStatus) {
var stepsCon = $this.stepControls;
stepsCon.removeClass('ui-state-highlight');
stepsCon.each(function (index) {
if (currentStepIndex >= index) {
$(this).addClass("ui-state-highlight");
}
});
}
,並開始按我的預期工作。
所有的JavaScript覆蓋看起來像
PrimeFaces.widget.Wizard.prototype.loadStep = function (stepToGo, isBack) {
var $this = this,
options = {
source: this.id,
process: this.id,
update: this.id,
formId: this.cfg.formId,
params: [
{name: this.id + '_wizardRequest', value: true},
{name: this.id + '_stepToGo', value: stepToGo}
],
onsuccess: function (responseXML, status, xhr) {
PrimeFaces.ajax.Response.handle(responseXML, status, xhr, {
widget: $this,
handle: function (content) {
this.content.html(content);
}
});
return true;
},
oncomplete: function (xhr, status, args) {
$this.currentStep = args.currentStep;
if (!args.validationFailed) {
var currentStepIndex = $this.getStepIndex($this.currentStep);
if ($this.cfg.showNavBar) {
if (currentStepIndex === $this.cfg.steps.length - 1) {
$this.hideNextNav();
$this.showBackNav();
} else if (currentStepIndex === 0) {
$this.hideBackNav();
$this.showNextNav();
} else {
$this.showBackNav();
$this.showNextNav();
}
}
//update step status
if ($this.cfg.showStepStatus) {
var stepsCon = $this.stepControls;
stepsCon.removeClass('ui-state-highlight');
stepsCon.each(function (index) {
if (currentStepIndex >= index) {
$(this).addClass("ui-state-highlight");
}
});
}
}
}
};
if (isBack) {
options.params.push({name: this.id + '_backRequest', value: true});
}
PrimeFaces.ajax.Request.handle(options);
};
該組件具有AJAX事件處理程序。那些你可以激發你喜歡的任何javascript的'oncomplete',包括使用一些jquery來查找活動標籤並將類添加到標籤之前。另一個選擇是下載組件的源代碼,對其進行調整並使其突出顯示更多內容。 – Kukeltje