跨多个列跨越ExtJS网格单元格内容

时间:2011-07-15 03:36:38

标签: extjs extjs4

如果单元格的文本大于该单元格中的文本,是否可以使该单元格跨越多个列?

例如,目前我的网格看起来像这样:

+--------+----------+-----+-----+-----+
|Product |Descrip...|     |     |     |
+--------+----------+-----+-----+-----+

由于第二列的内容太大而无法容纳在单元格中,因此内容会被截断。

我希望能够看到Description列的全文。因此跨越细胞,如图所示:

+--------+----------+-----+-----+-----+
|Product |Description of the product  |
+--------+----------+-----+-----+-----+

ExtJS 4网格可以实现吗?

3 个答案:

答案 0 :(得分:1)

您可以在列中指定宽度以获得所需的列大小,如下所示:

var grid = Ext.create('Ext.grid.Panel',{        
id  : 'example_grid',
columns : [{
id : 'product',
header : 'Product',
width : 50
},{
id : 'description',
header : 'Description of the Product',
width : 150
}]
});

答案 1 :(得分:0)

我几乎可以肯定这是不可能的。但是,您可以使用摘要插件在整行中显示内容。

答案 2 :(得分:0)

我怀疑你可以在extjs4网格中连接单元格。但是你可以将文本转移到下一行。

.wrapme {
  /** this rule is for css3. **/
  /** You can find crossbrowser workaround on the internet **/
  white-space: pre-wrap;
  word-wrap: break-word;
}

然后将cls包含在列配置

{
  id : 'description',
  header : 'Description of the Product',
  width : 150,
  cls : 'wrapme'
}
相关问题