0

EXT JS 4、Sencha Touch 2.0、および WebORB を試しています。

Sencha Touch の MVC で Ext を介して動的にストアを構築しようとしています。Index.html のセクションで、以下のように以下の JavaScript 関数を呼び出しました。

<script src="sencha-touch-all.js"></script>
                <script src="webORB.js"></script>
                <script>
                var dataFetched;
                var dataGet=function(){
        <!--  Class Name and URL are replaced in the original program-->
                this.proxy = webORB.bind("ClassName", "URL");
                    dataFetched=this.proxy.GetClassList(1301722);   
                //console.log(dataFetched);
            }
                </script>
                <script src="app.js">
</script>

以下は私のapp.jsです

Ext.Loader.setConfig({
    enabled: true

});
Ext.application({
    name: 'SBR',
    controllers: [
        'Main','Blog','Comments'
    ],
    views : [
    'Home','Blog', 'Comments'
],
    models : ['Comments'],
    stores: ['Comments'],
    launch: function(){
        dataGet();
        console.log(dataFetched);
        Ext.create('SBR.view.Viewport');
    }
});

以下は私のComment.jsです - ストア

Ext.define('SBR.store.Comments',{
    extend: 'Ext.data.Store',   
    config: {
        model: 'SBR.model.Comments',
        data: dataFetched
    }

});

以下はComment.js - モデルです

Ext.define('SBR.model.Comments',{
        extend: 'Ext.data.Model',

        config: {
            //fields: ['subject','body']
            fields: ['bookImageUrl','authorFirstName','authorLastName']
        }
    })

以下はComment.js - ビューです

Ext.define('SBR.view.Comments',{
    extend: 'Ext.List',
    xtype: 'commentspage',
    config:{
        title: 'Comments',
        iconCls: 'star',
        //indexBar: true,
        store : 'Comments',
        itemTpl: '{authorLastName}',
        onItemDisclosure: function(item) {
            console.log('Disclose more info on' + " " + item.data.subject);
        }
    }
});

静的 Json データでストアを定義すると正常に動作しますが、WebORB でアクセスしようとすると動作しません。

コンソールへの入力は、コンソールにデータを表示する前に行われます。コメントのビューにデータが表示されないのはなぜですか、または WebORB を介してデータを収集してストアにロードするための私のアプローチが完全に間違っているのはなぜですか?

4

1 に答える 1

0

あ、そうか……わかった……

以下を変更しただけです。

  1. 関数 dataget() を index.html から Comments.js-Store に転送し、同じファイルの構成内で同じ関数を次のように呼び出しました。

データ: dataGet()

それはそれです...それは働いた..

于 2013-05-20T06:02:00.897 に答える