Sencha Touch component.DataItem到动态列表

时间:2014-03-05 20:44:46

标签: extjs sencha-touch

好的,所以我有一个扩展Ext.dataview.component.DataItem'的视图我有这个功能

onNameButtonTap: function(button, e) {
    var record = this.getRecord();
    console.log("The tid of this record is: " + record.get('tid'));
}

我可以从此点击中获得tid,我想用它来加载一个新视图,该视图将使用此ID来更改代理网址以获取不同的数据。以下是观点:

Ext.define('AIN.view.Headlines.Card', {

extend: 'Ext.NavigationView',
xtype: 'headlineContainer',

config: {

    tab: {
        title: 'Headlines',
        iconCls: 'star',
        action: 'headlinesTab'
    },

    autoDestroy: false,

    items: [
        {
            xtype: 'headlines',
            store: 'Headlines',
        }
    ]
}
});

如何在我的商店中获取url参数以接受类似这样的URL 'http://mywebsite.com/app-feeds/channels/' + tid

感谢阅读,我是新手,经过几个小时的谷歌搜索,我无法理解这一点。

更新,这对我有用。

var store = Ext.StoreMgr.get('Headlines');

                    store: store.setProxy({
                            type: 'jsonp',
                            url: 'http://awebsite.com/app-feeds/channels/' + tid,
                            reader: {
                                type: 'json',
                                rootProperty: 'nodes',
                                record: 'node'
                            }
                        }).load()

1 个答案:

答案 0 :(得分:1)

您可以通过执行以下操作设置Ext.data.Store的网址:

store.getProxy().setUrl('http://mywebsite.com/app-feeds/channels/' + tid);

请注意,如果您计划在使用不同网址的多个区域中使用此Store,则可能需要在设置网址时创建新的实例。