javascript - EXT JS 使用列表显示使用表格的值。在表头中重复所有行

标签 javascript html css extjs

我是 ext js 的新手,现在我在列表中使用一个表

using table th and tr tags

 items: 
    [
        {
            xtype: 'list',
            itemTpl: '<div> <table > <tr><th> CountDown </th> 
                      <th> Date and Time</th> </tr> 
                      <tr> <td> {countValue}</td><td> {createdDateTime}
                      </td></tr></table> </div>'
        }
    ]

现在输出是这样的表头不应该在表中重复 output is coming like that now

最佳答案

也许您正在寻找 tpl 参数而不是 itemTpl

itemTpl - The tpl to use for each of the items displayed in this DataView.

tpl - A String, Ext.Template, Ext.XTemplate or an Array of strings to form an Ext.XTemplate. Used in conjunction with the data and tplWriteMode configurations.

例子:

tpl: [
    '<div><table>',
        '<th> CountDown </th>',
        '<th> Date and Time</th>',
        '<tbody>', 
            '<tpl for=".">', 
                '<tr><td>{countValue}</td><td>{createdDateTime}</td></tr>',
            '</tpl>', 
        '</tbody>',
    '</table></div>'
]

It look's like in DataView.List tpl can't be overrided. If you must attach something custom - you need to create new widget on your own.

也许您正在寻找 xtype grid,查看 fiddle 上的示例:https://fiddle.sencha.com/#view/editor&fiddle/2u6g

关于javascript - EXT JS 使用列表显示使用表格的值。在表头中重复所有行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57242236/

相关文章:

javascript - 页面刷新后执行jQuery函数

javascript - 使用 innerHTML 时 div 中的旧输入文本值

javascript - 在输入字段内向 JavaScript 函数传递参数与从函数内部传递参数

html - "Background-Image"不能在 CSS 中使用 "height:auto"?

javascript - fonts/ionicons.ttf?v=2.0.0 404(未找到)-CSS-Angular-localhost

html - WKHTMLTOPDF - 边框出现在 pdf 上

javascript - 如何使用标题名称使用 Javascript 更改图像的 href?

javascript - 根据条件动态地将脚本添加到我的应用程序

javascript - 如何构建 GWT 独立离线应用程序?

javascript - 将准确的 innerHTML 还原为 DOM