Я пытаюсь включить / отключить кнопку, основываясь на нажатии другой кнопки в моем xhtml.Это не работает, когда я использую AJAX-вызов, но работает, если я отключаю AJAX.
Как мне сделать эту работу.
XHTML (это работает, и кнопка набирается в течение нескольких секунд, но страницазагружается и кнопка снова включается)
<p:commandButton id="generateBtn" value="Generate Text"
action="#{decisionTreeBean.generateText}" styleClass="generateBtn" widgetVar="gb"
update=":#{p:component('decisionNotes')}" >
</p:commandButton>
<p:commandButton id="clearBtn" value="Clear"
action="#{decisionTreeBean.clearText}" styleClass="clearBtn" widgetVar="cb"
update=":#{p:component('decisionNotes')} :#{p:component('searchForm')}" ajax="false">
</p:commandButton>
xhtml (не работает вообще)
<p:commandButton id="generateBtn" value="Generate Text"
action="#{decisionTreeBean.generateText}" styleClass="generateBtn" widgetVar="gb"
update=":#{p:component('decisionNotes')}" >
</p:commandButton>
<p:commandButton id="clearBtn" value="Clear"
action="#{decisionTreeBean.clearText}" styleClass="clearBtn" widgetVar="cb"
update=":#{p:component('decisionNotes')} :#{p:component('searchForm')}">
</p:commandButton>
Jquery
<SCRIPT type="text/javascript">
jQuery(document).ready(function() {
if (top.frames.length != 0) {
top.location = self.document.location;
}
jQuery(".clearBtn").click(function(event){
PF('gb').disable(); // works without ajax
});
});
</SCRIPT>