Вопрос

I have a web sql database of browser. I just want to show the data of that table in my view class in sencha touch 2. But data is not being shown the view is empty here.I don't know why.Here is the code kindly help me out of someone knows the answer:

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'
                        }
                    }
            }

    ]
    }

});

here id is the name of the database in websql. I don't know what to write here exactly.

Это было полезно?

Решение

For websql, you'll need to use the sql proxy, not localstorage.

You'll find more info on how to use it in the doc and in this blog post, thanks to this post.

Другие советы

try below code

 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'
                        }
                    })
            }

    ]
    }

});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top