PDA

View Full Version : To ease documentation. Refactor Ext.layout.BorderLayout.Region constructor



Animal
9 Jan 2009, 7:19 AM
Instead of



Ext.layout.BorderLayout.Region = function(layout, config, pos){


Just



Ext.layout.BorderLayout.Region = function(layout, config){
this.position = config.region;


This way, the docs of BorderLayout can simply say that all child items of the border layout Container accept all the config options of Ext.layout.BorderLayout.Region

It's been a bone of contention for a long time now. People are confused by region and split and margins.

Condor
9 Jan 2009, 7:37 AM
+1

I would go even further and rename this.position to this.region (not 100% backward compatible of course).

Advantages:
1. Less code.
2. Better readable code (config option and property name are the same).
3. As Animal stated: Better API docs.

mystix
9 Jan 2009, 9:39 AM
+2

always had to check the docs and my own working code a couple of times before i was sure enough to respond to help posts.