简体   繁体   English

从更新中排除ID

[英]Exclude an id from update

Can I exclude a specific id from update=":myComponent" ? 我可以从update=":myComponent"排除特定ID吗?

I have a larger page (with several tables, input fields and so on) which is wrapped in a <p:panel id="outerPanel"> . 我有一个较大的页面(包含多个表,输入字段等),该页面包装在<p:panel id="outerPanel"> Most of the time, I just execute update=":outerPanel" , which works quite fine. 大多数时候,我只执行update=":outerPanel" ,效果很好。 But now I'm facing a problem that I have to update the page except for ONE table. 但是现在我面临一个问题,除了一个表,我必须更新页面。

How can I exclude that table (or any component in general) from an update process? 如何从更新过程中排除该表(或一般的任何组件)?

No, I think that is not possible from the facelet. 不,我认为这是不可能的。 On the server side you could manipulate the ajax request, but I don't think that is what you want. 在服务器端,您可以操纵ajax请求,但我认为这不是您想要的。

Maybe your view allows to wrap some h:panelGroup around the parts to update. 也许您的视图允许将h:panelGroup包裹在要更新的部分周围。

If the ID not to refresh can be identified by some logic (ie: 如果ID不刷新,可以通过一些逻辑来标识(即:

if(myVar==1) { idToExclue = 'id1';}
else // ... etc

Then you can try building a JSF call using the jsf.util.chain : (Note this uses Mojarra JSF impl.) 然后,您可以尝试使用jsf.util.chain构建JSF调用:(请注意,这使用Mojarra JSF impl。)

function myJsfSubmit(callerElement) {
  var myIdsToSubmit = 'main-form:id-to-refresh-1 main-form:id-to-refresh-2';
  // put your logic to exclude the desired ID here
  // ...
  // then
  jsf.util.chain(callerElement,null,'mojarra.ab(this,event,\'action\',
      \'main-form:id_to-submit\',\'+ myIdsToSubmit +\')');
  return false;
  }

And use that above function on the onClick() or onSubmit() of your form or component: 并在表单或组件的onClick()onSubmit()上使用上述函数:

<h:commandButton onclick="myJsfSubmit(this)" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM