JSF下dataGrid與Action綁定問題

今天在做頁面與action的datatree綁定時,碰到一個莫名奇妙的問題:

       頁面如下:

       <layout:panel region="center" animFloat="false" autoHide="false" border="false"
      fit="true" title="查詢結果">
      <w:dataGrid id="grid" showRowNumber="false" paged="true" rows="10" loadMask="true"
      forceFit="true" toolBarPosition="both" border="false" rowInitHeight="22" trackMouseOver="true"
      stripeRows="true" jsvar="gridJs">
       <w:toolBar styleClass="headerToolBar">
        <w:button οnclick="deleteNode();" image="#{hdf:reqContextPath()}/images/icons/delete.png" jsvar="deleteNodeJsvar" label="告警關閉" disabled="true"/>
        <w:separator />      
       </w:toolBar>
       <w:outputColumn id="eventName" header="事件名稱" sortable="true" ></w:outputColumn>
       <w:outputColumn id="soureType" header="資源類型" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcLevel" header="告警等級" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcType" header="告警類型"  sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcContent" header="告警內容" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcCount" header="次數" sortable="true"></w:outputColumn> 
       <w:outputColumn id="nodeid" header="選擇"  clientFormatter="showRadio" width="24" align="center" />
       <w:outputColumn id="eventName" header="事件名稱" sortable="true" clientFormatter="titleFormat"/>
       <w:outputColumn id="resourceType" header="資源類型" sortable="true"/>
       <w:outputColumn id="resourceName"  header="資源名稱"></w:outputColumn>
       <w:outputColumn id="clctName"  header="採集器名稱"></w:outputColumn>
       <w:outputColumn id="eventLevel" header="告警等級" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcTitle" header="告警標題" sortable="true"></w:outputColumn>      
       <w:outputColumn id="emgcContext" header="告警內容" sortable="true"></w:outputColumn>      
       <w:outputColumn id="notify" header="通知人" sortable="true" clientFormatter="nodehostFormat"></w:outputColumn>
       <w:outputColumn id="firstTime"  header="第一次告警時間" sortable="true"></w:outputColumn>
       <w:outputColumn id="lastTime" header="最後一次告警時間" sortable="true"></w:outputColumn>
       <w:outputColumn id="count" header="次數" sortable="true"></w:outputColumn>
       <w:outputColumn id="history" header="告警明細" sortable="true"></w:outputColumn>
       <w:outputColumn id="state" header="狀態" sortable="true"></w:outputColumn>      
       <w:pagingToolbar displayInfo="true" displayMsg="顯示 {0} - {1},共 {2} 條" />
      </w:dataGrid>
     </layout:panel>

 

     託管Bean獲取數據方法如下:

   @Bind
 private UIDataGrid grid;

    @DataModel(id = "grid")
 public List<EmgcCommonBean> getPresentEmgc() throws Exception{
  Map<String, Object> param = new HashMap<String, Object>();
 
  if(null != this.emgcType && !"".equals(this.emgcType)){
   param.put("emgcType", emgcType);
  }
 
 
 
  List<EmgcCommonBean> list = EmgcApprove.getInstance().queryPersentEmgc(param);
  System.out.println(list.get(0).getEventName().toString);
 
  return list;
 }

  後臺獲取數據正常,System能打印了,但前端卻怎麼都不顯示。

 

  經過仔細一番調試,發現後臺的字段與頁面字段不一致導致。(我爲了好調試,後臺只先讀取了幾個字段,而頁面顯示的是所有字段),我把頁面多餘的字段都去掉,保持與後臺讀出的字段一致,嘿,正常了。

 我們用的框架是金蝶的OperaMasks,看來對datatree的封裝還有bug啊!(或者說還不太好用!)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章