Threaded View

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    107
    Vote Rating
    -1
    Answers
    4
    sencha.user is an unknown quantity at this point

      0  

    Default Answered: Sending parameter to js

    Answered: Sending parameter to js


    Hi,

    I have a varialble in Controller like,

    Code:
    Ext.define('MyApp.controller.MyController', {
        extend: 'Ext.app.Controller',
        onFieldButtonClick: function(button, e, options) {
        var groupChecked = Ext.getCmp('groupgrid').getSelectionModel().getSelection();
            var arrayValues = [];
            Ext.each(groupChecked, function(rec, index) {
                arrayValues.push(rec.get('colName'));
            });
        var MyGrid = Ext.ComponentQuery.query('MyGrid')[0];
                        MyGrid.getStore().reload({
                            params:{
                                singleton: true,
                                param1: [arrayValues]
                            }
                        });
    ...
    I want to use this arrayValues in another js in another location, I am doing,
    Code:
    groupField: MyApp.controller.MyController.param1
    But I am not getting the value there, how should I do to get the selected value?

  2. Hi,

    It worked like this,
    Code:
    Ext.define('MySharedData', {
        singleton: true,
    
        foo: 'bar',
        meh: 42
    });
    Can then access using MySharedData.foo, for instance.

    Found in,
    http://www.sencha.com/forum/showthre...ble-in-Extjs-4

    Didn't try it correctly initially, now works good, it doesn't do grouping like expected anyway .

Thread Participants: 2