title: Pass variable into Primefaces selector
body: <p>In my JSF/Primefaces page I have a form containing a tabview, where each tab contains an accordion panel, and each accordion contains a data table. The full id of the single data table is something like <code>id="form:tabs:0:accordion:0:table"</code></p>
  
  <p>Each tab contains also a command button that must update data tables inside the tab itself, so it would not update tables inside the other tabs.</p>
  
  <p>Using Primefaces Selectors, I managed to update all the data tables which id finishes with "table": <code>update="searchValue @('div$=table')</code>, but I am not able to address all the data tables which id finished with "0:table", where "0" is dynamic (based on the current tab).</p>
  
  <p>I tried with:</p>
  
  <pre><code>&lt;ui:param name="ta" value="#{settore.id - 1}:table" /&gt;
  &lt;p:commandButton id="plainSearch" value="Filter"
      action="#{myBean.search()}"
      update="@('div$=#{ta}')"&gt;
  </code></pre>
  
  <p>but it gives me a Javascript error: <code>Uncaught Syntax Error: Unexpected identifier</code>, then the entire form is updated.</p>
  
  <p>How can I correctly pass a variable to a Primefaces selector?</p>
  
  <p>Here is my XHTML page:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
    &lt;p:tabView id="tabs" value="#{myBean.sectors}" var="tab"&gt;
      &lt;p:tab id="tab" title="#{tab.description}"&gt;
      &lt;p:commandButton id="plainSearch" value="Filter"
        action="#{myBean.search()}"
        update="@('div$=table')"&gt;
        &lt;p:accordionPanel id="accordion" value="#{myBean.getTabs()}" var="tab" multiple="true" activeIndex="#{myBean.activeIndexes}"&gt;
          &lt;p:tab id="accordionTab" title="#{tab.title}"&gt;
            &lt;p:dataTable id="table" var="row" value="#{myBean.getObjects()}"  emptyMessage="Empty table"&gt;
              &lt;p:column headerText="Code"&gt;
                &lt;h:outputText value="#{row.codice}" /&gt;
              &lt;/p:column&gt;
              &lt;p:column headerText="Description"&gt;
                &lt;h:outputText value="#{row.descrizione}" /&gt;
              &lt;/p:column&gt;
            &lt;/p:dataTable&gt;
          &lt;/p:tab&gt;
        &lt;/p:accordionPanel&gt;
      &lt;/p:tab&gt;
    &lt;/p:tabView&gt;
  &lt;/h:form&gt;
  </code></pre>