如何在 extjs 的 dataView table 中设置文本对齐

How to set text align in dataView table in extjs

我有一个数据视图,我想这样设置我的文本 详细信息:这是一个 testttete33 jlkxjcsksjcj jxzlkzxlckjzlcj;c;z zzcjzlcxl ; 让我在图片中向您展示我的

所以你看到我的 Details 字段不好(对齐) 这是我的代码

items: [{
  xtype: 'dataview',
  itemSelector: 'table',
  itemTpl: [
    '<tpl for=".">',
    '    <table width="100%" class="basic" style="min-height:100px;">',                       
    '        <tr>',
    '            <td width="25%"><b>ID #:</b></td>',
    '            <td width="25%">{id}</td>',
    '            <td width="25%"><b>Name:</b></td>',
    '            <td width="25%">{name}</td>',
    '        </tr>',
    '        <tr>',
    '             <td><b>Details:</b></td>',
    '             <td align="justify">{details}</td>',
    '        </tr>',
    '    </table>',
    '</tpl>'
  ],
  bind: {
    store: '{viewpermission}'
  }
}],

您已经设置了td align=justify,这就是您得到的。我在您的屏幕截图中看到它有效。

您的问题出在其他地方。这就是你的 table 现在的样子(我夸大了):

+---------+---------+---------+---------+
| ID #    | 29      | Name:   | testme  |
+---------+---------+---------+---------+
| Details:| this is |
|         | a  test |
|         | for  me |
|         | 1234567 |
+---------+---------+

你大概想要的是

+---------+---------+---------+---------+
| ID #    | 29      | Name:   | testme  |
+---------+---------+---------+---------+
| Details:| this  is  a   test  for  me |
|         | 1234567                     |
+---------+-----------------------------+

那么您真正要搜索的是 <td align="justify" colspan="3"...