我有與對一個問題:commandLinkCommandLink primefaces
這是鏈接代碼
<p:commandLink partialsubmit="true" id="c2aLink" immediate="true" ajax="true" update="generalPanel" action="#{tabularbean.refresh}"/>
點擊這個鏈接時重新加載頁面不只是更新面板的問題。
我想只更新不刷新整個頁面的面板再次
注:使用JavaScript代碼來點擊這個鏈接
javascript代碼:
render: function(options) { var c2aLink = this.findElementWithIdLike(iframe.contentWindow,'c2aLink'); c2aLink.click();},
findElementWithIdLike :function(wind,prefix) {
return this.findChildWithIdLike2(wind.document.body, prefix);
},
findChildWithIdLike2 :function(node, prefix) {
if (node && node.id && node.id.indexOf(prefix) >= 0) {
//match found
return node;
}
//no match, check child nodes
for (var index = 0; index < node.childNodes.length; index++) {
var child = node.childNodes[index];
var childResult = this.findChildWithIdLike2(child, prefix);
if (childResult) {
return childResult;
}
}
},`
你能發佈javascript代碼嗎? – dratewka
我更新了帖子以包含javascript代碼 – user2425231
當按鈕被點擊時,它是否提交了一個ajax請求,然後刷新比你想要的還要多,還是發生了完整的提交? – dratewka