Javascript sencha touch/phonegap-数据库

Javascript sencha touch/phonegap-数据库,javascript,cordova,sencha-touch,Javascript,Cordova,Sencha Touch,我正在开发一个应用程序,需要列出国家和城市。很明显,这可能是一个相当大的数据库-存储这些数据的最佳方式是什么 我不想使用远程数据库,因为我希望该应用程序可以脱机使用 我对任何格式(xml、javascript数组、cvs等)都持开放态度。您可以使用本地json文件,并通过sencha touch存储(Ext.data.store)访问此文件。使用sencha touch的模型和存储功能来读取json web服务或文件,并使其可供您的视图使用 Ext.regModel('Product', {

我正在开发一个应用程序,需要列出国家和城市。很明显,这可能是一个相当大的数据库-存储这些数据的最佳方式是什么

我不想使用远程数据库,因为我希望该应用程序可以脱机使用


我对任何格式(xml、javascript数组、cvs等)都持开放态度。

您可以使用本地json文件,并通过sencha touch存储(Ext.data.store)访问此文件。

使用sencha touch的模型和存储功能来读取json web服务或文件,并使其可供您的视图使用

Ext.regModel('Product', {
    fields: [
        {name: "id", type: "int"},
        {name: "pid", type: "int"},
        {name: "type", type: "string"},
        {name: "status", type: "string"},
        {name: "title", type: "string"},
        {name: "content", type: "auto"},
        {name: "date", type: "string"},
        {name: "modified", type: "string"}  
    ]
});


MVCApp.ProductStore = new Ext.data.Store({
    model: 'Product',
    autoLoad: true,
    storeId: 'ProductStore',
    proxy: {
        type: 'ajax',
        id: 'ProductStore',
        url: 'data/nestedProducts.json',
        reader: {
            root: 'items'
        }
    }
});