数据始终无法读出来,取出来的JSON为[count:7,items:[{"Slots":null,"Id":4,"DisplayOrder":100,"ChannelName":"6ur","ChannelDesc":"utr"},{"Slots":null,"Id":5,"DisplayOrder":100,"ChannelName":"345345","ChannelDesc":"23423"},{"Slots":null,"Id":6,"DisplayOrder":100,"ChannelName":"345345","ChannelDesc":"23423"},{"Slots":null,"Id":7,"DisplayOrder":100,"ChannelName":"345345","ChannelDesc":"23423"},{"Slots":null,"Id":8,"DisplayOrder":100,"ChannelName":"345345","ChannelDesc":"23423"},{"Slots":null,"Id":9,"DisplayOrder":100,"ChannelName":"345345","ChannelDesc":"23423"},{"Slots":null,"Id":10,"DisplayOrder":1,"ChannelName":"ertert","ChannelDesc":"rgdg"}]]
Ext.define('local', {
extend: 'Ext.data.Model',
fields: ['ChannelName', 'ID', 'ChannelDesc', 'DisplayOrder', 'Slots']
});
Ext.define('Gotogether.Advertisement.ChannelList', {
extend: 'Ext.panel.Panel',
alias: 'widget.channellist',
title: '频道',
collapsible: true,
animCollapse: true,
margins: '5 0 5 5',
layout: 'fit',
initComponent: function () {
Ext.apply(this, {
items: [{
xtype: 'dataview',
trackOver: true,
store: returnStore(),
model: 'local',
itemSelector: '.feed-list-item',
overItemCls: 'feed-list-item-hover',
tpl: '
listeners: {
selectionchange: this.onSelectionChange,
scope: this
}
}]
});
this.callParent(arguments);
},
onSelectionChange: function (selmodel, selection) {
var selected = selection[0],
button = this.down('button[action=remove]');
if (selected) {
button.enable();
}
else {
button.disable();
}
}
});
function returnStore() {
var proxy1 = new Ext.data.HttpProxy({
type :'ajax',
method: 'get',
url: '../../handler/ChannelHandler.ashx?method=listChannel'
});
var reader1 = new Ext.data.JsonReader({
count : 'count',
root: 'items'
},
[
{ name: 'ChannelName', mapping: 'ChannelName' },
{ name: 'ID', mapping: 'ID' }
]
);
// 构建Store
var store = new Ext.data.Store({
proxy: proxy1,
reader: reader1
});
// 载入
return store;
}