代码之家  ›  专栏  ›  技术社区  ›  Mulone

Ext.data.JsonStore+Ext.DataView=未加载记录

  •  0
  • Mulone  · 技术社区  · 16 年前

    我正在尝试使DataView工作(在extjs2.3上)。

    Ext.onReady(function() {
          var prefStore = new Ext.data.JsonStore({
            autoLoad: true, //autoload the data
            url: 'getHighestUserPreferences',
            baseParams: {
              userId: 'andreab',
              max: '50'
            },
            root: 'preferences',
            fields: [{
                name: 'prefId',
                type: 'int'
              },
              {
                name: 'absInteractionScore',
                type: 'float'
              }
            ]
          });
    

    然后是xtemplate:

    var tpl = new Ext.XTemplate(
        '<tpl for=".">',
            '<div class="thumb-wrap" id="{name}">',
                '<div class="thumb"><img src="{url}" title="{name}"></div>',
                '<span class="x-editable">{shortName}</span>
            </div>',
        '</tpl>',
        '<div class="x-clear"></div>'
    );
    

    专家组:

    var panel = new Ext.Panel({
          id: 'geoPreferencesView',
          frame: true,
          width: 600,
          autoHeight: true,
          collapsible: false,
          layout: 'fit',
          title: 'Geo Preferences',
    

        items: new Ext.DataView({
          store: prefStore,
          tpl: tpl,
          autoHeight:true,
          multiSelect: true,
          overClass:'x-view-over',
          itemSelector:'div.thumb-wrap',
          emptyText: 'No images to display'
        })
      });
      panel.render('extOutput');
    });
    

    我在页面上看到的是一个有标题的蓝色框架,但里面什么都没有。 如何调试它并查看它为什么不工作?

    1 回复  |  直到 6 年前
        1
  •  3
  •   Lloyd    16 年前

    模板{name}等中的项引用存储中的字段,在您的示例中,这些字段只是前缀和absInteractionScore。