简体   繁体   English

如何在Tapestry Grid中添加其他行?

[英]How to add additional rows to Tapestry Grid?

I have a Grid together with its GridDataSource. 我有一个网格及其GridDataSource。 However, I want to show one column of that grid under all the others. 但是,我想显示该网格在所有其他列下的一列。

Here's the example: 这是示例:

I have this so far: 到目前为止,我有:

| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 |
========================================================
| Data 11  | Data 12  | Data 13  | Data 14  | Data 15  |
--------------------------------------------------------
| Data 21  | Data 22  | Data 23  | Data 24  | Data 25  |
--------------------------------------------------------

I would like to achieve this: 我想实现这一目标:

| Column 1 | Column 2 | Column 3 | Column 4 |
=============================================
| Data 11  | Data 12  | Data 13  | Data 14  |
|                  Data 15                  |
---------------------------------------------
| Data 21  | Data 22  | Data 23  | Data 24  |
|                  Data 25                  |
---------------------------------------------

I was thinking of try to add a <tr> after first 4 column cells and put my DataX5 inside it, but that's got me nowhere. 我当时想尝试在前4个列单元格后添加<tr>并将DataX5放入其中,但这无济于事。

You could use my griddecorator mixin and apply a GridRowDecorator to each row. 您可以使用我的griddecorator mixin并将GridRowDecorator应用于每一行。 The decorator creates a new row after the current and moves the last element to the new row. 装饰器在当前行之后创建一个新行,并将最后一个元素移动到新行。

If not, create your own mixin which tweaks the DOM once the grid has rendered. 如果没有,请创建您自己的mixin,一旦网格渲染,它就会调整DOM。 You might want to take a look at my gridcollapse mixin where I move columns and rows about and add rowspans. 您可能要看一下我的gridcollapse mixin,在其中移动列和行并添加行跨度。

Another, slightly dodgy, way is to use outputRaw and a custom cell to get around tapestry's properly formed XML requirements. 另一种略显狡猾的方法是使用outputRaw和自定义单元格来解决挂毯的正确形成的XML要求。

Eg 例如

<t:grid source="..." value="current">
   <p:column5Cell>     
      <t:outputRaw value="&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='4'&gt;" />
      ${current.column5}
   </p:column5Cell>
</t:grid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM