1

I have created a table for displaying books be signed out/in of an department. There are sorted on: Name, Date. Every so often (after some check-ins and check outs are made) the books are inventoried to confirm how many are available (and numbers are corrected according).

I currently have a table that displays all of the books sorted by Name, Date. But since there are a lot of rows I was hoping to have collapsible section based on when this type of book was inventoried.

Desired:

Name |  Date | Count | Action
-----------------------------
- First Foo Section -
Foo    SomeD     +3    check-in
Foo    SomeD     -1    check-out
Foo    SomeD     5     inventoried
+ Another Foo Section
+ Bar Section

Current Code:

<c:forEach var='item' items='${bookLogs}'>
            <tr>
                <td>${f:replaceNewLineWithBR(f:escapeHtml(item.name))}</td>
                <td><c:out value='${item.date.formattedValue}'/></td>
                <td>${f:replaceNewLineWithBR(f:escapeHtml(item.count))}</td>
                <td>${f:replaceNewLineWithBR(f:escapeHtml(item.actionType))}</td>
            </tr>
    </c:forEach>

Should I do a test on item.actionType? Or should I pass bookLogs as a list of lists for the different collapsing sections in the table?

4

3 回答 3

4

我上面的评论没有回答你的问题,但这里有一个关于如何做到这一点的教程http://www.a2ztechguide.com/2011/07/javascript-expand-collapse-table-rows.html

很久以前我用数据库做了这个,现在我们使用 xml 并显示我们需要的内容并不好玩。

上面的链接做得很好,并解释了如何使用 javascript 进行展开和折叠。您上面的代码在正确的轨道上,但还没有完全到位。

于 2012-06-18T18:59:31.860 回答
0

我建议您为客户使用广泛可用的基于 JS 的表格/网格解决方案。

http://www.omnisdata.com/omnigrid/

http://dhtmlx.com/docs/products/dhtmlxGrid/index.shtml

和许多其他人。我个人使用过 Omnigrid,发现它值得投入几个小时来提出这种可以适应未来需求和当前趋势的东西。

于 2012-06-24T16:43:42.167 回答
0

看看 Bootstrap,它有一些非常棒的特性,尤其是表格。

http://twitter.github.com/bootstrap/

于 2012-06-25T15:28:42.930 回答