2014-04-28 23 views
0

我有一個瀏覽器的Web數據庫。我只是想在sencha touch 2中的視圖類中顯示該表的數據。但是,數據並未顯示在這裏視圖是空的。我不知道爲什麼。這裏的代碼好心地幫助我,回答:列表視圖不填充sencha觸摸2 localstorage網絡sql數據

Ext.define('FirstApp.view.UsersView',{ 
extend:'Ext.dataview.List', 
xtype:'userlist', 

requires:[ 
      'Ext.dataview.List', 
      'Ext.data.proxy.LocalStorage', 
      'Ext.data.identifier.Uuid' 
     ], 
config:{ 
    title: 'User List', 
    iconCls: 'star', 

    items:[ 
      { 
       xtype:  'list', 
       itemTpl: '{name}', 
       title: 'Students', 

       store:{ 
        autoLoad: true, 
        fields: ["name","email"], 

        proxy:{ 
          type: 'localstorage', 
          id: 'Student' 
         } 
        } 
      } 

    ] 
    } 

}); 

這裏id是websql中數據庫的名稱。我不知道該寫些什麼。

回答

1

有關的WebSQL,你需要使用SQL代理,而不是localStorage的。

您可以在docthis blog post中找到更多信息,這要歸功於this的帖子。

+0

感謝您的回覆!所以你的意思是Web SQL與本地存儲是分開的?在我的情況下,我有Web SQL類別中的數據庫... –

0

嘗試下面的代碼

Ext.define('FirstApp.view.UsersView',{ 
extend:'Ext.dataview.List', 
xtype:'userlist', 

requires:[ 
      'Ext.dataview.List', 
      'Ext.data.proxy.LocalStorage', 
      'Ext.data.identifier.Uuid' 
     ], 
config:{ 
    title: 'User List', 
    iconCls: 'star', 

    items:[ 
      { 
       xtype:  'list', 
       itemTpl: '{name}', 
       title: 'Students', 

       store:new Ext.create('Ext.data.Store',{ 
        autoLoad: true, 
        fields: ["name","email"], 

        proxy:{ 
          type: 'localstorage', 
          id: 'Student' 
         } 
        }) 
      } 

    ] 
    } 

});