extjs 渲染器未执行
extjs renderer not executed
我正在使用带有 extjs 6.5.1 的现代工具包。
我想在网格单元格中使用渲染器 属性 来使用 html。渲染器只是 returns '<a>...</a>'
,但是当我使用它时,它将对 html 代码进行编码,以便单元格显示 '<a>...</a>'
而不是 link。
关于这个线程的答案,我需要一个 属性 的单元格 "encodeHtml" 变成 false 但是一旦我添加一个单元格 属性 渲染器就不会再执行(即使我使用EncodeHtml) 并像没有渲染器一样显示数据 属性。
为什么我不能再使用渲染器 属性?
这是我的代码:
{
xtype: 'gridcolumn',
renderer: function(value, record, dataIndex, cell, column) {
console.log('hello world');
return '<a>...</a>';
},
width: 30,
text: '...',
cell: {
xtype: 'textcell',
encodeHtml: false
}
}
What it looks like without encodeHtml
此行为是因为您指定
cell: {
xtype: 'textcell'
}
首先。只需删除它,您的 renderer
就可以 return HTML。这应该有效:
{
xtype: 'gridcolumn',
renderer: function(value, record, dataIndex, cell, column) {
console.log('hello world');
return '<a>...</a>';
},
width: 30,
text: '...'
}
至少我的应用程序中有 id,我使用 renderer
s returning html 生成特殊格式。
如果您需要指定 cell
属性,因为您没有在代码中显示某些内容,请改用默认的 cell
xtype
:gridcell
.
我正在使用带有 extjs 6.5.1 的现代工具包。
我想在网格单元格中使用渲染器 属性 来使用 html。渲染器只是 returns '<a>...</a>'
,但是当我使用它时,它将对 html 代码进行编码,以便单元格显示 '<a>...</a>'
而不是 link。
关于这个线程的答案,我需要一个 属性 的单元格 "encodeHtml" 变成 false 但是一旦我添加一个单元格 属性 渲染器就不会再执行(即使我使用EncodeHtml) 并像没有渲染器一样显示数据 属性。
为什么我不能再使用渲染器 属性?
这是我的代码:
{
xtype: 'gridcolumn',
renderer: function(value, record, dataIndex, cell, column) {
console.log('hello world');
return '<a>...</a>';
},
width: 30,
text: '...',
cell: {
xtype: 'textcell',
encodeHtml: false
}
}
What it looks like without encodeHtml
此行为是因为您指定
cell: {
xtype: 'textcell'
}
首先。只需删除它,您的 renderer
就可以 return HTML。这应该有效:
{
xtype: 'gridcolumn',
renderer: function(value, record, dataIndex, cell, column) {
console.log('hello world');
return '<a>...</a>';
},
width: 30,
text: '...'
}
至少我的应用程序中有 id,我使用 renderer
s returning html 生成特殊格式。
如果您需要指定 cell
属性,因为您没有在代码中显示某些内容,请改用默认的 cell
xtype
:gridcell
.