ykksqq520 2011-08-31 14:44
浏览 183
已采纳

请问一个EXT绑定数据的问题

数据始终无法读出来,取出来的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: '

{ChannelName}
',
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;
}

  • 写回答

9条回答 默认 最新

  • myali88 2011-08-31 18:10
    关注

    [quote]
    用你写的代码可以,不过我想知道我写的哪里出了问题
    [/quote]
    没办法复原你的执行情况,我也很难知道原因。还有你页面加载后,reader的请求是否发出呢,是不是没有设置“autoLoad”的原因啊?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用