我很困惑这个dataView是空的!我有相同的设置处理图像,但它不显示在这里。我错过了什么吗?谢谢你的帮助。
JSON:
{rows:[{"noteid":"4","txid":"97","contactid":"38","displayname":"Jeb Hafkin","txdate":"08\/20\/2010","date":"12\/08\/2011","type":"Treatment Note","content":"new test<img src=\"..\/logos\/1912323619.jpg\">","subject":"Jeb's note","firstname":"Jeb","lastname":"Hafkin"},{"noteid":"6","txid":"0","contactid":"51","displayname":"Bill Hyyman","txdate":null,"date":"12\/12\/2011","type":"","content":"test","subject":"","firstname":"Bill","lastname":"Hyyman"}], "success": true}
data store,tpl,dataview:
var noteStore = new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields: ['noteid','txid','contactid', 'displayname', 'date',
'subject','txdate','type','amtpd','content' ],
root: 'rows',
id: 'noteid'
}),
proxy: new Ext.data.HttpProxy({
url: '/request.php?x=noteStore'
})
});
var tpl = new Ext.XTemplate (
'<tpl for ".">',
'<p class="note">noteid = {noteid} </p>',
'</tpl>'
);
var noteDataView = new Ext.DataView({
store: noteStore,
tpl: tpl,
autoHeight:true,
multiSelect: true,
overClass:'x-view-over',
itemSelector:'p.note',
emptyText: 'No notes to display'
});
var notePanel = new Ext.Panel ({
layout: 'fit',
padding: 10,
items: [noteDataView],
tbar: noteTb
});
答案 0 :(得分:0)
需要加载商店。尝试将autoLoad:true添加到商店:
var noteStore = new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields: ['noteid','txid','contactid', 'displayname', 'date',
'subject','txdate','type','amtpd','content' ],
root: 'rows',
id: 'noteid',
}),
proxy: new Ext.data.HttpProxy({
url: '/request.php?x=noteStore'
}),
autoLoad: true
});