【问题标题】:sencha touch load store manuallysencha touch load store 手动
【发布时间】:2014-07-05 15:29:22
【问题描述】:

简单用例:我想在加载商店时手动控制。加载商店时,我希望数据填充列表。但是,我无法让它工作。

当我在商店中将 autoLoad 设置为 true 时,它​​可以工作。如果我删除 autoLoad,并将其添加到视图中,则不会发生任何事情。

列表配置:

{
   xtype: 'list',
   fullscreen: true,
   disableSelection: true,
   store: 'NewsStore',
   itemId: 'newsList',
   itemTpl: '<li><strong>{date} - {title}</strong><br/>{text}</li>',
   plugins: [
   {
       xclass: 'Ext.ux.touch.PullRefreshFn',
       pullText: 'Henter nyheter',
       refreshFn: function () {
           Ext.getStore('NewsStore').load();
       }
   }
]}

面板上的监听器将加载商店:

listeners: {
        painted: function () {
            Ext.getStore('NewsStore').load();
        }
    }

我尝试使用加载方法中的回调。我试图从列表中获取商店并更新它,但没有任何效果(列表只是空的并且不显示任何内容,即使我可以看到代码正在获取信息)。知道我在这里做错了什么吗?

【问题讨论】:

  • 如何将商店绑定到视图?最好能看到完整的视图配置。
  • 添加了列表配置。它实际上只是一个以该列表为内容的 Ext.Panel。我什至尝试在列表的 store-property 中做一个 Ext.create(store) ,但这也没有用。

标签: javascript extjs sencha-touch


【解决方案1】:

您必须使用 setStore 属性来填充数据

var myStore = Ext.getStore('NewsStore');

Now access the list object and just 

mylist.setStore(myStore);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-26
    • 2014-02-06
    • 2012-08-18
    • 2013-07-04
    • 2012-12-22
    • 1970-01-01
    相关资源
    最近更新 更多