0

我有一个 sencha touch 2 应用程序,无需部署即可完美运行。但是,当我部署到测试、生产或本机时,导航视图中有几个按钮,这些按钮将不再起作用。没有显示错误。我无法理解为什么只有在部署之后才会发生这种情况。

以下是相关代码:

控制器:

control: {

        '#main-function': {
            tap: 'loadFunction'
         },


         loadMyBoat: function() {
              this.getProducts().up().push({
          xtype: 'myxtype',
         })



         Ext.getStore('Items').getProxy().setUrl('myurl');
         Ext.getStore('Items').load();
},

看法:

Ext.define('MyBoat.view.ItemList', {
extend: 'Ext.navigation.View',
xtype: 'myxtype',

config: {
    title: 'My Title',
    styleHtmlContent: true,
    defaultBackButtonText: 'Items List',

    items: {
        xtype: 'list',
        itemTpl: '{Field_Name}',


        title: 'Tap on a boat to access further details',
        store: 'Boats'
    }
}
})

有人遇到过这个吗?任何帮助将不胜感激。

4

2 回答 2

0

After lots of debugging I managed to fix the problem. Turns out that using the following code to generate any component will not work well after deployment:

new Ext.button({.....})

Instead you have to use xtypes rather than the new keyword. I think this has something to do with the fact that the deployer stores all the js code in one file and thus since I was using the new keyword, it was being created somewhere in the js file when it actually won't exist in the context. The weird thing is that it does not show any errors so hopefully this will help other folks.

于 2012-06-12T07:28:58.843 回答
0

打开你的 DOM 编辑器(我相信在 chrome 中,F12)。您的控件选择器正在选择#main-function,因此您需要确保这是一个有效的选择器。

在开发人员工具窗口的控制台上,键入:

Ext.ComponentQuery.query('#main-function')

这应该是控制器正在尝试的。

于 2012-06-08T15:59:58.667 回答