简体   繁体   English

JSON存储的AJAX请求参数。 ExtJS

[英]AJAX request parameters for JSON store. ExtJS

I want to string together some parameters into an address where I can view an AJAX request in browser ... I think this is what I mean, though I am not comfortable talking about AJAX. 我想将一些参数连接到一个地址中,以便在浏览器中查看AJAX请求 。我认为这是我的意思,尽管我不太愿意谈论AJAX。 I am only a novice front-end web application programmer. 我只是一个新手前端Web应用程序程序员。

So to start, I have an ExtJS application with a combobox. 首先,我有一个带有组合框的ExtJS应用程序。 It is populated by items in a JSON file, from what I can tell. 据我所知,它由JSON文件中的项目填充。 Here is the application code snippet: 这是应用程序代码段:

                items: [{
                xtype : 'combobox',
                queryMode : 'remote',
                fieldLabel: 'twittersearch',
                typeAhead : true,
                allowBlank : applicationtype === 'relatedanalysis' ? true : false,
                hideTrigger : false,
                editable : false,
                multiSelect : true,
                minChars : 1,
                store : 'smcc.TwitterSearch',
                displayField : 'id',
                name : 'twittersearch',
                listConfig: {
                    getInnerTpl: function() {
                        return  '<div><img src="../media/com_concilium/images/twitter/{sn}-logo-med.png" />{id}</div>';
                    }
                }
            }

So I understand how store's work in the extJS MVC setup. 因此,我了解了extJS MVC设置中store的工作方式。 Documentation here: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox-cfg-store 此处的文档: http : //docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.ComboBox-cfg-store

So I searched 'twittersearch' at the root of my all component files with windows explorer to find the proper twittersearch.js store file. 因此,我使用Windows资源管理器在所有组件文件的根目录下搜索了“ twittersearch”,以找到正确的twittersearch.js存储文件。 Here it is: 这里是:

Ext.define('Container.store.smcc.TwitterSearch', {
extend : 'Ext.data.Store',
model : 'Container.model.smcc.TwitterSearch',
autoLoad : false,

proxy : {
    type : 'ajax',
    url : './',
    extraParams : {
        option : 'com_concilium',
        view : 'smcc',
        format : 'raw',
        controller : 'smcc',
        task : 'getSocalMediaStream'
    },
    reader : {
        type : 'json',
        root : 'rows',
        totalProperty: 'row_count'
    }
},

}); });

So is this enough information to create an address and perhaps look at the data? 那么,这些信息足以创建地址并查看数据吗? I assume it is something like urlbase/index.php?option=com_concilium&view=smcc&format=raw&controller=smcc&task=getSocialMediaStream 我认为它像urlbase / index.php?option = com_concilium&view = smcc&format = raw&controller = smcc&task = getSocialMediaStream

You should be able to create the store 您应该能够创建商店

var store = Ext.create('Container.store.smcc.TwitterSearch');

and then call 然后打电话

store.load();

If you use Chrome browser, you should see the network request in the Chrome Developer Tools network panel. 如果您使用的是Chrome浏览器,则应在“ Chrome开发者工具”网络面板中看到网络请求。

https://developers.google.com/chrome-developer-tools/docs/network https://developers.google.com/chrome-developer-tools/docs/network

I would recommend trying to replicate the sencha examples , using jsfiddle.net, which lets you "fiddle" with the code easily. 我建议尝试使用jsfiddle.net复制sencha 示例 ,它使您可以轻松地“弄弄”代码。

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

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