【问题标题】:Can i change the layout of YUI datatable?我可以更改 YUI 数据表的布局吗?
【发布时间】:2010-01-09 05:14:42
【问题描述】:

我的 Web 应用程序使用 YUI 数据表向用户显示记录。

我不希望它是行和列布局。我可以使用我自己的布局,例如单行单列中记录的所有数据。考虑 StackOverflow 问题页面。

我可以用 YUI 数据表这样做吗?

【问题讨论】:

    标签: layout yui yui-datatable


    【解决方案1】:

    使用单行/列,您宁愿失去表格的大部分好处,但如果您真的想使用 DataTable,请尝试自定义单元格格式化程序。

    这个例子是一个很好的起点:http://developer.yahoo.com/yui/examples/datatable/dt_formatting.html

    您的数据源可以包含对象而不是每个单元格的字符串/数字,然后您可以从中呈现复杂的单元格标记。

    例如

    complexLookingCellFormatter = function(elLiner, oRecord, oColumn, oData) { 
         // oData is normally text, but objects work too...
         elLiner = "<h1>oData.yourTitle</h1><strong>oData.yourText</strong>";
    }
    

    【讨论】:

    • @gavin 在哪里通过complexLookingCellFormatter
    • 当你定义你的columnDefs时,每一列都可以接受一个格式化函数:{ key: 'some_col', sortable: true, label: 'Some Column', formatter: complexLookingCellFormatter },
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-01
    • 2018-11-01
    • 1970-01-01
    • 2012-03-02
    相关资源
    最近更新 更多