点击后渲染组件 [英] Render the Components after the click

查看:212
本文介绍了点击后渲染组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < p:commandButton value =提交 $ = $$$$$$$$$$$ ,Baskerville Old Face,
Hoefler Text,Garamond,Times New Roman,serif;
font-size:14px; font-weight:normal'
update =:form:table,:form:filter>< / p:commandButton>



< p:dataTable id =tablevalue =#{DataTable.dataTable}var =table
lazy =true rowKey =#{table.sheet_no}selectionMode =single
selection =#{DataTable.selectedSheet}scrollable =true
scrollHeight =150rendered =#{DataTable。加载}
style =widht:400px; margin-left:200px; margin-right:25px>
< / p:dataTable>

< h:panelGrid id =filtercolumns =1cellpadding =10cellspacing =2
rendered =#{DataTable.filter}
style =position:absolute; bottom:15px; right:150px; border:1px solid#1f497d; box-shadow:10px 10px 25px#888888;
height:auto; width:600px; Text-align:center ;>
< p:outputLabel value =筛选搜索以获取结果。>< / p:outputLabel>
< / h:panelGrid>

这是支持bean

  public String getValues(){
DataTable.isLoaded = true;
DataTable.Filter = false;
System.out.println(获取值);
System.out.println(DataTable.isLoaded);
System.out.println(DataTable.Filter);
System.out.println(state);
System.out.println(district);
returnhello;

DataTable.isLoaded = true; DataTable.Filter = false;是被访问的静态布尔值。当isLoaded成为true时,我想显示表并隐藏过滤面板..如何做到这一点..

  ; p:dataTable id =disptablevalue =#{DataTable.dataTable}
var =tablelazy =truerowKey =#{table.sheet_no}
selectionMode = $$ {$ data =#{DataTable.selectedSheet}
scrollable =truescrollHeight =150rendered =#{DataTable.loaded}
style =widht:auto; margin-left :300px; margin-right:30px
widgetVar =tabl>

< p:column headerText =Sheet Numberstyle =width:25%>
< h:outputLabel value =#{table.sheet_no}>< / h:outputLabel>
< / p:column>

< p:column headerText =Statestyle =width:25%>
< h:outputLabel value =#{table.state_cd}>< / h:outputLabel>
< / p:column>

< p:column headerText =Districtstyle =width:25%>
< h:outputLabel value =#{table.district_cd}>< / h:outputLabel>
< / p:column>

< p:column headerText =Detailsstyle =width:25%>
< h:commandLink title =Complete Detailsvalue =Complete Details>< / h:commandLink>
< / p:column>

< f:facet name =footer>
< p:commandButton id =selectButtonicon =images\show.png
update =:form:disponcomplete =PF('Dialog')。show()
process =@ this,tablestyle =height:25px;
action =#{tabs.addTabs}ajax =true/>
<! - 所选项目数: - >
< / f:facet>
< / p:dataTable>


解决方案

您的组件似乎有些重载,似乎没有必要,例如部分提交,处理,选择,可滚动等。
这不应该是实际的问题,但限制错误的可能性可以帮助您更接近解决方案。



一些点:




  • 这三个元素是否相同?您正在更新中使用:form:table 表单:过滤器,这不清楚您使用的表单。


  • 是getValues()在控制台中提供任何输出,甚至不调用?你也不需要返回一个String,一个void方法可以做这个工作


  • 尝试使用#{menuBean.getValues} / p>


  • 尝试更新@form,而不是特定元素



I want to render the data table after clicking the button submit .

<p:commandButton value="Submit" action="#{MenuBean.getValues}"
                        type="submit" partialSubmit="true" process="statemenu,dist,@this"
                        style='font-family: font-family : Baskerville, "Baskerville Old Face",
        "Hoefler Text", Garamond, "Times New Roman", serif;
    font-size: 14px; font-weight: normal'
                        update=":form:table,:form:filter"></p:commandButton>



 <p:dataTable id="table" value="#{DataTable.dataTable}" var="table"
                lazy="true" rowKey="#{table.sheet_no}" selectionMode="single"
                selection="#{DataTable.selectedSheet}" scrollable="true"
                scrollHeight="150" rendered="#{DataTable.loaded}"
                style="widht:400px ; margin-left:200px;margin-right:25px">
</p:dataTable>

<h:panelGrid id="filter" columns="1" cellpadding="10" cellspacing="2"
            rendered="#{DataTable.filter}"
            style="position:absolute;bottom:15px;right:150px;border: 1px solid #1f497d;box-shadow: 10px 10px 25px #888888;
            height:auto;width:600px;Text-align:center;">
            <p:outputLabel value="Filter your search to get result."></p:outputLabel>
        </h:panelGrid>

Here is the backing bean

public String getValues() {
    DataTable.isLoaded = true;
    DataTable.Filter = false;
    System.out.println("getting the values");
    System.out.println(DataTable.isLoaded);
    System.out.println(DataTable.Filter);
    System.out.println(state);
    System.out.println(district);
    return "hello";

The DataTable.isLoaded = true; DataTable.Filter = false; are static boolean value which are accessed . When isLoaded becomes true i want to show the table and hide the filter panel .. how to do this..??

<p:dataTable id="disptable" value="#{DataTable.dataTable}"
            var="table" lazy="true" rowKey="#{table.sheet_no}"
            selectionMode="single" selection="#{DataTable.selectedSheet}"
            scrollable="true" scrollHeight="150" rendered="#{DataTable.loaded}"
            style="widht:auto ; margin-left:300px;margin-right:30px"
            widgetVar="tabl">

            <p:column headerText="Sheet Number" style="width:25%">
                <h:outputLabel value="#{table.sheet_no}"></h:outputLabel>
            </p:column>

            <p:column headerText="State" style="width:25%">
                <h:outputLabel value="#{table.state_cd}"></h:outputLabel>
            </p:column>

            <p:column headerText="District" style="width:25%">
                <h:outputLabel value="#{table.district_cd}"></h:outputLabel>
            </p:column>

            <p:column headerText="Details" style="width:25%">
                <h:commandLink title="Complete Details" value="Complete Details"></h:commandLink>
            </p:column>

            <f:facet name="footer">
                <p:commandButton id="selectButton" icon="images\show.png"
                    update=":form:disp" oncomplete="PF('Dialog').show()"
                    process="@this,table" style="height:25px;"
                    action="#{tabs.addTabs}" ajax="true" />
                <!--    Count of Items Selected :  -->
            </f:facet>
        </p:dataTable>

解决方案

Your components seem to be a bit overloaded with attributes which don't seem necessary, e.g. partialSubmit, process, selection, scrollable etc. This shouldn't be the actual problem, but limiting possibilities for errors can help getting closer to the solution.

Some points:

  • are these three elements within the same form? You are using :form:table and form:filter in your update, this doesn't make clear what forms you are using.

  • is getValues() giving you any output in the console or is it not even called? You also don't need to return a String, a void method would do the job

  • try using #{menuBean.getValues}, with a small m

  • try updating @form, not specific elements

这篇关于点击后渲染组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆