0
我想從數據存儲創建鏈接列表,然後使用XTemplate循環顯示數據存儲中的所有鏈接。我試圖在模態窗口中顯示鏈接。這是我的代碼:如何在ExtJs中添加鏈接到模態窗口
var win;
var tpl = new Ext.XTemplate("<p>Field1: {f1}, Field2: {f2} </p>").compile();
var data = {
f1: 'a',
f2: null
};
if(!win){
win = new Ext.Window({
el:'hello-win',
layout:'fit',
width:500,
height:300,
closeAction:'hide',
plain: true,
items: [
{
xtype: 'component',
autoEl: {
html: '<input type="text">'
},
listeners: {
render: function(_component) {
_component.getEl().on('keyup', function(e) {
//console.log(this);
console.log(this.dom.childNodes[0].value);
});
}
}
},
{
xtype: 'panel',
title: 'test',
height: 100,
bodyPadding: 10,
tpl: tpl,
data: data,
renderTo: Ext.get('hello-win')
}
]
});
}
win.show(this);
在控制檯中沒有錯誤,但鏈接從未加載。它只是顯示我的模式窗口和我的文本框,但沒有鏈接。我會加入一個jsfiddle,但我不知道如何(我是ExtJs的新手)。
如何在此模式窗口中顯示鏈接列表?
謝謝,很好的答案。我想看看如果你不介意共享,你會怎麼做'textfield'。 – user1477388
我在我的答案中更新了代碼。 – Akatum