綠野仙棕

          常用鏈接

          統(tǒng)計(jì)

          hibernate技術(shù)

          最新評(píng)論

          JSF DataTable 學(xué)習(xí)(2)

          h:dataTable標(biāo)簽用來(lái)生成表格,感覺就和struts的logic:iterator差不多,下面是一般的用法:

          其中這個(gè)items可以是一個(gè)集合(其類型可以是array、java.util.List、java.sql.ResultSet、javax.servlet.jsp.jstl.sql.Result、javax.faces.model.DataModel,循環(huán)遍歷所有的item),或者是其他任何非集合的元素(循環(huán)一次)。
          注意1)h:dataTable里面只能包含h:column。2)在h:dataTable這種能render子元素的標(biāo)簽中,要顯示原始文本的話,要用<f:verbatim></f:verbatim>將文本包含起來(lái)(或者用h:outputText)。3) <f:facet name="header">和<f:facet name="footer">可以制定表頭和表尾。

          h:dataTable有以下這些屬性:

          bgcolor
          ?Background?color?for?the?table
          ?
          border
          ?Width?of?the?table's?border
          ?
          cellpadding
          ?Padding?around?table?cells
          ?
          cellspacing
          ?Spacing?between?table?cells
          ?
          columnClasses
          ?Comma-separated?list?of?CSS?classes?for?columns
          ?
          first
          ?Index?of?the?first?row?shown?in?the?table
          ?
          footerClass
          ?CSS?class?for?the?table?footer
          ?
          frame
          ?Specification?for?sides?of?the?frame?surrounding?the?table?should?be?drawn;?valid?values:?none,?above,?below,?hsides,?vsides,?lhs,?rhs,?box,?border
          ?
          headerClass
          ?CSS?class?for?the?table?header
          ?
          rowClasses
          ?Comma-separated?list?of?CSS?classes?for?columns
          ?
          rules
          ?Specification?for?lines?drawn?between?cells;?valid?values:?groups,?rows,?columns,?all
          ?
          summary
          ?Summary?of?the?table's?purpose?and?structure?used?for?non-visual?feedback?such?as?speech
          ?
          var
          ?The?name?of?the?variable?created?by?the?data?table?that?represents?the?current?item?in?the?value
          ?
          binding,?id,?rendered,?styleClass,?value
          ?Basic?attributes
          ?
          dir,?lang,?style,?title,?width
          ?HTML?4.0
          ?
          onclick,?ondblclick,?onkeydown,?onkeypress,?onkeyup,?onmousedown,?onmousemove,?onmouseout,?onmouseover,?onmouseup
          ?DHTML?events


          有一個(gè)很有意思的例子,它可以生成一個(gè)動(dòng)態(tài)可編輯的表格:

          事實(shí)上,h:dataTable不是直接操作集合對(duì)象的,而是通過(guò)Table Models來(lái)實(shí)現(xiàn)的。所以我們可以通過(guò)getWrappedData()和setWrappedData()來(lái)實(shí)現(xiàn)對(duì)modle中對(duì)象的操作,比如下面的一個(gè)方法:

          同時(shí)如果我們要對(duì)集合數(shù)據(jù)進(jìn)行排序和過(guò)濾的話,我們必須通過(guò)繼承一種table model來(lái)實(shí)現(xiàn)。

          posted on 2006-09-28 12:12 土牛小屋 閱讀(2994) 評(píng)論(2)  編輯  收藏 所屬分類: jsf技術(shù)

          評(píng)論

          # re: JSF DataTable 學(xué)習(xí)(2) 2008-05-09 16:39 小曾

          你好,如果我 要輸出寬度為300,2列的表格。第一列寬為100,第二列的寬為200,第一列里的內(nèi)容要粗體,第二列的內(nèi)容字體為紅色。內(nèi)容用h:outputText輸出,那我該怎么寫呢。謝謝  回復(fù)  更多評(píng)論   

          # re: JSF DataTable 學(xué)習(xí)(2) 2010-05-05 23:23 liuche

          能否給出一個(gè)排序的例子?謝謝啦!
          wnh5@tom.com  回復(fù)  更多評(píng)論   


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 梁山县| 财经| 饶平县| 商丘市| 新干县| 江城| 西贡区| 丹阳市| 孙吴县| 木里| 丽水市| 铁力市| 吴桥县| 格尔木市| 平顶山市| 黄山市| 广南县| 谷城县| 朔州市| 咸丰县| 晋宁县| 依兰县| 金平| 灌南县| 江津市| 留坝县| 察隅县| 肥乡县| 桐乡市| 微山县| 洛阳市| 庆云县| 衡阳市| 星子县| 潜山县| 财经| 陵水| 会东县| 安庆市| 同心县| 黄冈市|