AlecPerkey
AlecPerkey

Reputation: 657

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. I am only a novice front-end web application programmer.

So to start, I have an ExtJS application with a combobox. It is populated by items in a JSON file, from what I can tell. 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. Documentation here: 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. 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

Upvotes: 0

Views: 5804

Answers (1)

Neil McGuigan
Neil McGuigan

Reputation: 48246

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.

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.

Upvotes: 1

Related Questions