开发者

Trying to use value in togglefield by calling the controller

is there a way to receive some return value from a controller like

app.controllers.theController = new Ext.Controller({
    ...
    getPrefsData: function(options){
        //console.log("@getPrefsData: " + options.datastring);
        return options.datastring;
    },
...

to use it inside a panel-item:

app.views.PrefsView = Ext.extend(Ext.Panel, {
        ...
        items: [
                            xtype: 'togglefield',
                            name: 'enableThis',
                            l开发者_开发知识库abel: 'Enabler',
                            value : HERE I NEED THE VALUE FROM THE CONTROLLER,
        ]

something like

value: Ext.dispatch({
    controller: app.controllers.clockcontroller,
    action: 'getPrefsData',
    datastring:'alarm'
});

doesn't work...


Maybe this will help;

In my application I needed to use somekind of session variable when switching between panels. A user selects an item in a list, and in the next panel I want to know what the ID was of the selected item.

Getting a return value from the controller (/function) didn't work out for me.

Instead I used:

        Ext.apply(panel, {
            testVariabele: index,
        }), 

This piece of code allowed me to set a 'global' variable ("panel" is the ID of my main panel) inside the function (controller). To access the variable in another panel or card you can now use:

panel.testVariabele;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜