0

I have a controller something like this:

Ext.define('DigitalPaper.controller.Documents', {
extend: 'Ext.app.Controller',

views:  ['Documents'],
stores: ['Documents'],
models: ['Documents'],

config: {
  defaultColumnSet: undefined  
},....

I want to call the method getDefaultColumnSet or setDefaultColumnSet from the view. Is this possible?

I have tried with

     Ext.app.Controller.getController('Documents');

But it doesn't work!

Any suggests?

sha
  • 17,824
  • 5
  • 63
  • 98

1 Answers1

1

It's not a good idea to call controller methods from a view. It's possible, but if you're trying to use MVC paradigm - I would avoid doing it.

What exactly are you trying to achieve?

sha
  • 17,824
  • 5
  • 63
  • 98
  • Agreed. Your controller should push the default column set to the view via the view's initial configuration or a method the view provides for the controller to call. – JohnnyHK Jun 20 '12 at 17:04
  • I would get the properties (config properties like "defaultColumnSet" in the example above) from the view, usually this is a very common procedure in MVC paradigm... any suggests? – Pierluigi B Web Developer Jun 21 '12 at 07:54
  • 1
    This is not common procedure. Again - you're not explaining _why_ exactly do you need this. I understand you need to get property, but what are you gonna do with it and why do you need it? What's the underlaying logic? – sha Jun 21 '12 at 11:48