Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update via RequestContext

I am trying to update a table by using RequestContext.update() The following code is working (jsf):

<h:panelGrid columns="2" style="width: 100%" columnClasses="treeColumn,tableColumn">
        <h:panelGroup id="treePanel">
            <p:tree id="tree" 
                    value="#{bean.root}" 
                    var="node" 
                    dynamic="true"
                    cache="true"
                    animate="true"
                    selectionMode="single"
                    selection="#{bean.selectedNode}"
                    rendered="#{bean.renderTree}"> 
                <p:ajax event="select" listener="#{bean.onNodeSelect}" update=":mainForm:treePanel,:mainForm:tablePanel"/>
                <p:ajax event="collapse" listener="#{bean.onNodeCollapse}"/>
                <p:treeNode expandedIcon="ui-icon-folder-open"  
                            collapsedIcon="ui-icon-folder-collapsed">  
                    <h:outputText value="#{node.name}" styleClass="tableTreeText"/>  
                </p:treeNode> 
                 <p:treeNode expandedIcon="ui-icon-folder-open"  
                             collapsedIcon="ui-icon-folder-collapsed">  
                    <h:outputText value="#{node.name}" styleClass="tableTreeText"/>  
                </p:treeNode> 
            </p:tree> 
        </h:panelGroup>
        <h:panelGroup id="tablePanel" styleClass="acqPanelTable">
            <p:dataTable id="acqDataTable"
                         widgetVar="acqTablehdsWidget"
                         var="acq"
                         value="#{bean.list}" 
                         rendered="#{bean.renderTable}"
                         filteredValue="#{bean.filteredList}"
                         paginator="true"
                         paginatorPosition="bottom"

     .....
     ....
     ...
     ..
     .

But not via the server side:

 RequestContext requestContext = RequestContext.getCurrentInstance();
 requestContext.update(":mainForm:tablePanel");
 renderTable = true;

I don’t understand what is the different ?

Appreciate your help for any advice

Thanks

like image 479
angus Avatar asked Jul 08 '13 22:07

angus


1 Answers

Remove the leading colon.

requestContext.update("mainForm:tablePanel");

It's always resolved relative to UIViewRoot. The leading colon is only valid when you're currently sitting in an UINamingContainer component in the view.

like image 144
BalusC Avatar answered Oct 13 '22 01:10

BalusC