如何将函数参数之一传递给extjs4中的存储类?

时间:2013-10-21 04:15:06

标签: javascript jquery html5 css3 extjs4

在其中一个窗口中,我将搜索类型作为参数传递。之后,我在 mcmFindCityPair 中获取搜索类型,并传递 mcmFocusMarketStore 存储。我需要在名为 mcmFocusMarketStore 的商店中传递搜索类型。我传入了商店,但它说没有定义searchType。任何人都可以帮我重新组织代码。 摘录如下:

window.js 这是代码......

App.mcmFindCityPair(this.mcmSearchType, this.mcmOriginTextbox.getValue(),
                    this.mcmDestinationTextbox.getValue(),this.mcmStartDateTimeField.getValue(), 
                    this.mcmEndDateTimeField.getValue());

app.js 这是代码

mcmFindCityPair : function(searchType, org, dest, start, end) {
        App.mcmFocusMarketStore.removeAll(true);
        var startDate = start ? Ext.Date.format(start, 'd-M-y H:i') : '';
        var endDate = end ? Ext.Date.format(end, 'd-M-y H:i') : '';
        console.log(searchType);
        App.mcmFocusMarketStore.proxy.url = getProxyUrl()
                + "&action=getFMFlights&searchType="+searchType
                + ("&origin=" + org)
                + ("&destination=" + dest)
                + (startDate ? ("&startDate=" + startDate) : '')
                + (endDate ? ("&endDate=" + endDate) : '');
        console.log(App.mcmFocusMarketStore.proxy.url);
        App.mcmFocusMarketStore.load();
        App.mcmAllFocusMarketStore.removeAll(true);
        App.mcmAllFocusMarketStore.proxy.url = getProxyUrl()
                + "&action=getFMFlights&searchType="+searchType;
        App.mcmAllFocusMarketStore.load();
    }



App.mcmFocusMarketStore = Ext.create(
                    'Ext.data.Store',
                    {
                        model : 'FocusMarketModel',
                        proxy : {
                            timeout : AJAX_TIMEOUT,
                            type : 'jsonp',
                            url : getProxyUrl()
                                    + "&action=getFMFlights&searchType="+ searchType,
                            reader : {
                                type : 'focusmarketReader',
                                root : 'success',
                                totalProperty : 'total'
                            },
                            listeners : {
                                exception : function(proxy, exception,
                                        operation) {
                                    alert('Failed to get any kind of response from server! The application will be restarted. ');

                                }
                            }
                        }
                    });

任何人都可以帮我重新组织代码。提前致谢

0 个答案:

没有答案