View Full Version : [CLOSED] ComponentLoader issue

Apr 12, 2012, 8:25 PM
I generate a GridPanel that has a CheckBoxSelecionModel using ComponentLoader.ToJason. The Selecion has a handler that pass another element to a javascript function. If i set "testFunc(elementName);" when the function is called the control is not the control expected. I cannot set "testFunc(#{elementName});" because the ComponentLoader fails (Error during ClientConfig initialization.).

Any help will be appreciated :)

CheckboxSelectionModel selMdl = new CheckboxSelectionModel { ID = "_smd", Mode = SelectionMode.Single };
selMdl.Listeners.SelectionChange.Handler = "testFunc(#{elementName});";

Apr 12, 2012, 8:28 PM
In <Loader> element itīs possible to accomplish this task setting the Scripts property to true. How can i do it in component loader?

Apr 12, 2012, 9:11 PM
i could use selMdl.Listeners.SelectionChange.Handler = "testFunc(Ext.getCmp(elementName));" but i think that itīs not a good practice. Could someone give me directions to overcome this problem?

Apr 12, 2012, 9:28 PM
If 'elementName' is grid then you can use 'this.view.panel' in the selection model event handler

selMdl.Listeners.SelectionChange.Handler = "testFunc(this.view.panel);";

Also in v2, there is default namespace - App
So, if widget has ID="GridPanel1" then you have add 'App.' to ID injavascript code (of course, if widget is not inside INamingContainer, in this case ID != ClientID)

selMdl.Listeners.SelectionChange.Handler = "testFunc(App.elementName);";