AnsweredAssumed Answered

Face Planting With Layouts

Question asked by miguelfuerte on Sep 25, 2017
Latest reply on Sep 27, 2017 by morky01

It was easy to conjure up a nested layout using the nested config approach with xtypes.  It rendered nicely.  Got all excited and cocky like, "This stuff is easy-peasy!"

 

Here's the config approach I used that worked:

 

rally-blocked/App.js at master · mjstrong0112/rally-blocked · GitHub 

 

Yet, in more than one tutorial and best-practices article, the authors strongly recommended against taking this approach.

 

For one, they said it's better to save components to local variables for more efficient reference.  This avoids the less performant drill down to find elements by name or ID, etc.  They also said it's more readable and easier to debug.

 

I'm sure the latter is true, once you get the hang of it, but I've tried many variations and I find myself floundering due to my lack of experience in Javascript, in general.  

 

I tried the var approach:

 

var topContainer = Ext.create('Ext.panel.Panel', {
layout: {
type: 'hbox',
align: 'stretch'
}, ...

 

I've tried the property approach:

 

topContainer: Ext.create('Ext.panel.Panel', {
layout: {
type: 'hbox',
align: 'stretch'
}, ...

 

I've tried declaring these inside an Ext.onReady() function, inside the launch function, and just outside of all other functions, at the "top" level.

 

Now I get:

 

Console Errors

 

It's throwing a rod as I try to create the first component, a Release combo box.

 

I lack some fundamental understanding of how things are flowing under the hood, apparently.

 

Again, it's been 12 years since I've coded and this is my first rodeo in Javascript.

 

I realize that I've strayed from some of the demo samples, but some of those are a blend of explicit component creation and xtypes.  I want to do explicit references for all components saved in local variables so I can easily change 1 in response to another being changed.

 

Wish I had some mentor folks co-located with me, in an Agile team sort of way.  

 

Thanks, in advance for any thoughts or coaching.

 

Mike

Attachments

Outcomes