Proper/appropriate way to get references to objects
Proper/appropriate way to get references to objects
Hi All,
I'm just learning Sencha, and have seen different ways to get references to objects like views. I want to ensure that I'm doing it in a proper way that isn't spawning new instances, etc.
I use the technique below to navigate to cards in a card layout, which works well from a UI perspective. Is ComponentQuery.query a good way to get object references?
var mView = Ext.ComponentQuery.query("mainview")[0];
var moreMessagesView = Ext.ComponentQuery.query("moremessages")[0];
This logic is better served in a controller and then use the 'refs' config. This will let you get references to views and keep the logic of switching views out of your UI layer. Plenty of examples / posts for using 'refs' in the forums
Thanks so much. I'll look into incorporating the obj references there instead. I have started to use refs for some things, but don't fully understand its behavior yet. Seems powerful though.