我一直在尝试在API响应的日志级别为0的每个行单元格中返回一个alert图标,但我最终只得到一个[object Promise]而不是图标本身。我记录了data.logLevel,它显示了正确的日志级别。我在渲染器中使用商店中的函数完成了所有这些。有人能告诉我为什么这不起作用吗?我可以尝试让它起作用吗?
我的专栏在这里:
{
text: 'isLow',
flex: 1,
renderer: function (value, metaData, record, rowIndex, colIndex, store, view) {
return new Promise(function (resolve, reject) {
store.sendConfigTaskRequest2(record.get('jobId'))
.then(function (response) {
var data = Ext.decode(response.responseText);
if (data.logLevel === 0) {
var html = '<div class="u4f-backgroundjobs-alert-icon" style="display: block; margin: 0 auto; height: 20px; width: 20px;" title="Full Log Activated!"></div>';
resolve(html);
} else {
resolve('');
}
})
.catch(function (error) {
reject(error);
});
}).then(function (html) {
// Return the resolved HTML to display the icon
return html;
});
},
align: 'center',
draggable: false,
resizable: false
}
我在商店里有我的“sendConfigTaskRequest2”,如下所示:
sendConfigTaskRequest2: function (jobId) {
var me = this;
return new Promise(function (resolve, reject) {
Ext.Ajax.request({
url: U4.data.proxy.UrlTemplate.replaceParameters({
jobId: jobId,
}, me.proxy.api.config),
jsonData: JSON.stringify({
jobId: jobId
}),
method: 'GET',
success: function (data) {
resolve(data);
},
failure: function (data) {
reject(data);
}
});
});
},
欢迎提供任何意见。
1条答案
按热度按时间byqmnocz1#
它可以使用依赖渲染器方法来实现。
小提琴:https://fiddle.sencha.com/#view/editor&fiddle/3n4g