简体   繁体   English

javascript Sencha touch仅在浏览器中不在设备上显示数据

[英]javascript Sencha touch not displaying data on device only in browser

Sencha touch 2.4.1 not displaying data on device, but does in browser. Sencha touch 2.4.1不在设备上显示数据,但在浏览器中显示。 Here is my code: 这是我的代码:

{
                    flex: 3,
                    xtype: 'container',
                    type: 'hbox',
                    layout: 'fit',
                    height: '400px',
                    align: 'center',
                    items: [{
                        xtype: 'dataview',
                        height: '400px',
                        store: myStore,
                        padding: 15,
                        itemTpl: "{foo}"

                    }]

"{Foo}" only displays in browser, but never does on my device. “ {Foo}”仅在浏览器中显示,而在我的设备上则不显示。 Everything else displays and works perfectly on both. 其他所有内容均可在两者上完美显示并正常运行。 When I debug the device, I can add a break point to the store: myStore, line I see that it contains all the correct information for "{foo}" but will not display on device. 在调试设备时,我可以在store: myStore,添加一个断点store: myStore,行我看到它包含了“ {foo}”的所有正确信息,但是不会显示在设备上。 Help. 救命。

Any ideas? 有任何想法吗? Thanks 谢谢

Store code: 商店代码:

var myStore = Ext.create('myApp.store.myStore');
var myStoreTwo = Ext.create('myApp.store.myStoreTwo');


Ext.application({
    name: 'myApp',

    requires: [
        'Ext.MessageBox',
        'myApp.store.amyStore',
        'myApp.store.myStoreTwo'
    ],

    views: [
            'Main',
            '...'
        ],

        models: [
                 '...',
                 '...',
                 '...'
             ],

        stores: [
                 'myApp.store.myStore',
                 'myStoreTwo',
                 '...'
             ],

I create variables of the stores because in my Main class I have to change some of the store's proxy settings then pass it into the other classes for use. 我创建商店的变量,因为在主类中,我必须更改商店的某些代理设置,然后将其传递给其他类以供使用。 And the only way I can get that to work is to create instances of them with vars. 我能使它起作用的唯一方法是使用vars创建它们的实例。

Probably, your data structure a bit different or corrupted. 可能您的数据结构有些不同或已损坏。 Try to put the following in your item template. 尝试将以下内容放入您的项目模板。 It will show you the data that passed to the template: 它将显示传递给模板的数据:

itemTpl: "{[console.log(values)]} {foo}"

Make sure while packaging the app through sencha app build command you have mentioned the required json/xml file in app.json , without which it will not bundle the data files during the packaging. 确保通过sencha app build命令打包应用sencha app build您在app.json中提到了所需的json / xml文件, 否则 ,打包过程中它不会捆绑数据文件。 I think that you are trying to get a data from a json/xml file using proxy:{ type:'ajax'} . 我认为您正在尝试使用proxy:{ type:'ajax'}从json / xml文件中获取数据。

Moreover, when you are including the json/xml files in app.json, don't forget to refresh the sencha app by using sencha app refresh command in your application directory. 此外,当您在app.json中包含json / xml文件时,请不要忘记在应用程序目录中使用sencha app refresh命令来刷新sencha应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM