谁对 richfaces:suggestionbox比较熟呀?

Mrpublic 2009-05-08
一个suggestionbox 怎么同时向两个h:inputText给值呀?

我用richfaces live Demo上的第二个例子
卻得不到和他一樣的結果

1.它的例子代码地址:
http://livedemo.exadel.com/richfaces-demo/richfaces/suggestionBox.jsf?c=suggestionBox&tab=usage

2.
我的代码:

<ui:composition template="/layout/template.xhtml">
   <ui:define name="body">
<script type="text/javascript">
       function printObjectsSelected(output, sgcomponent){
               output.innerHTML=sgcomponent.getSelectedItems().pluck('name');
           }
</script>
<h:form >
     <rich:panel>
   <h:panelGrid columns="3">
        <h:outputLabel value="員工工號:" />
<h:inputText  style="width : 136px;" id="getemployee">
<h:outputText id="objects" style="font-weight:bold" />
</h:panelGrid>
<rich:suggestionbox id="xs" for="getemployee"
suggestionAction="#{Mybean.autoAction}" var="emp"
onselect="printObjectsSelected(#{rich:element('objects')}, #{rich:component('xs')});"
nothingLabel="No data found" fetchValue="#{emp.employeeNumber}">
<h:column>
<f:facet name="header"><h:outputText value="员工编号" /></f:facet>
<h:outputText value="#{emp.employeeNumber}" />
</h:column>
<h:column>
<f:facet name="header"><h:outputText value="员工姓名" /></f:facet>
<h:outputText value="#{emp.name}" />
</h:column>
</rich:suggestionbox>
...
Mrpublic 2009-05-08
<h:outputText id="objects" style="font-weight:bold" /> 根本就不顯示?
Mrpublic 2009-05-08

autoAction:


public List<Employee> autoAction(Object e) {
String pref = (String) e;
List<Employee> list = em.createQuery(
"select m from Employee m where m.employeeNumber like concat('"
+ pref + "','%') .getResultList();
return list;
}
ranyut 2009-09-14
你现在解决没有 没有的话 去看看我的这篇文章
我给出了我的解决方案 没办法 它本身没有名值对应 只有自己写了
http://just4java.iteye.com/blog/348818
Mrpublic 2009-09-15
謝謝。。。
Global site tag (gtag.js) - Google Analytics