我需要重置ap:tree中的选定值.我在表单中创建了一个重置按钮,我将我的p:tree元素放入其中.该按钮将树的选定值作为空值.在支持bean中,当我按下此按钮时,值清晰.但是在界面中,即使我刷新页面,旧的选定值仍然标记.这是我的代码:
电话号码:树
<p:tree id="treeClassifier"
value="#{navBarController.rootClassifier}"
var="node"
selectionMode="checkbox"
selection="#{navBarController.selectedClassifiers}"
style="height: 100px;width: 280px; margin-bottom: 0px; overflow: auto">
<p:treeNode expandedIcon="ui-icon-folder-open"
collapsedIcon="ui-icon-folder-collapsed">
<h:outputText value="#{node.description}(#{node.code})"/>
</p:treeNode>
</p:tree>
Run Code Online (Sandbox Code Playgroud)
创建树:
public TreeNode initTree(GenericTree<Classifier> tree) {
GenericTreeNode<Classifier> root = tree.getRoot();
TreeNode rootJSF = new DefaultTreeNode("root", null);
for (GenericTreeNode<Classifier> gnt : root.getChildren()) {
if (gnt.getData().getId() != -1) {
TreeNode childTree = new DefaultTreeNode(gnt.getData(), rootJSF);
//rootJSF.getChildren().add(childTree);
//f_aux(gnt, rootJSF);
addChildsToTree(gnt, childTree);
}
}
return rootJSF;
}
public void addChildsToTree(GenericTreeNode<Classifier> parent, TreeNode parentJSF) {
for (GenericTreeNode<Classifier> child : parent.getChildren()) {
TreeNode newNode …Run Code Online (Sandbox Code Playgroud) 确切地说,我该怎么做?尝试:
<f:facet id="form" name="header" class="customHeader">
<h:outputText value="HELLO!"/>
</f:facet>
Run Code Online (Sandbox Code Playgroud)
和我的 CSS:
.customHeader th{
background-color: activeborder;
background-image: none;
}
Run Code Online (Sandbox Code Playgroud)
我记得将 CSS 文件包含到 JSF 页面中:
<link type="text/css" ref="stylesheet" href="./newcss.css"/>
Run Code Online (Sandbox Code Playgroud)
但没有结果,我无法更改标题颜色,我根本看不到任何变化。有什么帮助吗?
下面是生成的 HTML 代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="j_idt2">
<title>Facelet Title</title>
<link type="text/css"
ref="stylesheet"
href="./newcss.css" />
</head
><body>
<form id="j_idt5"
name="j_idt5"
method="post"
action="/HTableJSF/faces/newjsf.xhtml"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt5" value="j_idt5" />
<table style="background-color: black">
<thead>
<tr>
<th colspan="1" scope="colgroup">HELLO!</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="row1">HELLO</span>
</td>
</tr>
</tbody>
</table>
<input type="hidden"
name="javax.faces.ViewState"
id="j_id1:javax.faces.ViewState:0"
value="-3603525257247985306:-5087066467544098625"
autocomplete="off" /> …Run Code Online (Sandbox Code Playgroud) 我在用户点击菜单时更新我的数据表.所以我想显示一些加载图像,而ajax获取数据并更新我的数据表.我为此目的使用p:blockUI.我的菜单是:
<h:form id="leftMenu">
<p:menu id="privilegeItem">
<p:menuitem id="objectItem"
actionListener="#{selectSignMethodView.changeSignMethods('object')}"
value="Object Signing Services"
update=":signMethodForm:signMethodTable"/>
<p:menuitem id="mobileItem"
actionListener="#{selectSignMethodView.changeSignMethods('mobile')}"
value="Mobile Signing Services"
update=":signMethodForm:signMethodTable"/>
<p:menuitem id="macItem"
actionListener="#{selectSignMethodView.changeSignMethods('mac')}"
value="Mac Signing Services"
update=":signMethodForm:signMethodTable"/>
<p:menuitem id="solarisItem"
actionListener="#{selectSignMethodView.changeSignMethods('solaris')}"
value="solaris Signing Services"
update=":signMethodForm:signMethodTable"/>
</p:menu>
</h:form>
Run Code Online (Sandbox Code Playgroud)
我的数据表是这样的:
<h:form prependId="false" id="signMethodForm">
<p:dataTable id="signMethodTable"
value="#{selectSignMethodView.signMethodList}"
var="signMethods">
<p:column>
<h:outputText value="${signMethods.name}"/>
</p:column>
<p:column>
<h:outputText value="#{signMethods.fileTypes}" />
</p:column>
<p:column>
<h:outputText value="#{signMethods.servers}"/>
</p:column>
</p:dataTable>
<p:blockUI trigger=":leftMenu:privilegeItem" block="signMethodTable">
LOADING<br />
<p:graphicImage library="images" name="ajax-loader.gif"/>
</p:blockUI>
</h:form>
Run Code Online (Sandbox Code Playgroud)
但是blockUI没有阻止我的数据表.我的触发器属性有问题.
jsf 2.0 素面 5.1 玻璃鱼 4
我正在通过下拉列表使用过滤,当我单击列表中的一个项目时,数据表会被过滤,但下拉列表中的值仍然显示“选择一个”而不是选定的值
<p:column headerText="Region" filterBy="#{wan.Region}"
filterMatchMode="contains" >
<f:facet name="filter">
<p:selectOneMenu onchange="PF('table').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}"
noSelectionOption="true" />
<f:selectItems value="#{wandbBean.regions}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{wan.Region}" />
</p:column>
Run Code Online (Sandbox Code Playgroud)