{"id":918,"date":"2022-08-30T15:09:21","date_gmt":"2022-08-30T15:09:21","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/how-to-call-set-or-get-a-controllers-config-property-from-a-view-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:09:21","modified_gmt":"2022-08-30T15:09:21","slug":"how-to-call-set-or-get-a-controllers-config-property-from-a-view-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-call-set-or-get-a-controllers-config-property-from-a-view-collection-of-common-programming-errors\/","title":{"rendered":"How to call set or get a Controller&#39;s config property from a view?-Collection of common programming errors"},"content":{"rendered":"<p>I have a controller something like this:<\/p>\n<pre><code>Ext.define('DigitalPaper.controller.Documents', {\nextend: 'Ext.app.Controller',\n\nviews:  ['Documents'],\nstores: ['Documents'],\nmodels: ['Documents'],\n\nconfig: {\n  defaultColumnSet: undefined  \n},....\n<\/code><\/pre>\n<p>I want to call the method getDefaultColumnSet or setDefaultColumnSet <strong>from the view<\/strong>. Is this possible?<\/p>\n<p>I have tried with<\/p>\n<pre><code>     Ext.app.Controller.getController('Documents');\n<\/code><\/pre>\n<p>But it doesn&#8217;t work!<\/p>\n<p>Any suggests?<\/p>\n<ol>\n<li>\n<p>It&#8217;s not a good idea to call controller methods from a view. It&#8217;s possible, but if you&#8217;re trying to use MVC paradigm &#8211; I would avoid doing it.<\/p>\n<p>What exactly are you trying to achieve?<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:58:15. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I have a controller something like this: Ext.define(&#8216;DigitalPaper.controller.Documents&#8217;, { extend: &#8216;Ext.app.Controller&#8217;, views: [&#8216;Documents&#8217;], stores: [&#8216;Documents&#8217;], models: [&#8216;Documents&#8217;], config: { defaultColumnSet: undefined },&#8230;. I want to call the method getDefaultColumnSet or setDefaultColumnSet from the view. Is this possible? I have tried with Ext.app.Controller.getController(&#8216;Documents&#8217;); But it doesn&#8217;t work! Any suggests? It&#8217;s not a good idea to call [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-918","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/918","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=918"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/918\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=918"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=918"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=918"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}