Custom overflowHandler in ExtJS 4 (Part 1)

Vi Veri Veniversum Vivus Vici

We need to implement overflowHandler for toolbar layout, which will add second toolbar and wraps components from first toolbar to second when them cannot be displayed because there isn't enough width of toolbar's container.First, we need to override Ext.panel.Panel:

Custom overflowHandler in ExtJS 4 (Part 2)

Vi Veri Veniversum Vivus Vici

Next, we need to create class Ext4.layout.container.boxOverflow.TBar2 (it has so long name because ExtJS searches handleOverflow (which is instance of String) in hardcoded Ext4.layout.container.boxOverflow namespace).

JavaScript static members of class

Vi Veri Veniversum Vivus Vici

This example shows how to share property between class instances and use static methods. We need to use 'for' loop instead of Array.prototype.concat because in case we'll use 'concat' method, we'll assign static array to instance of class, not to prototype of class constructor. So, we need to loop over an array and use 'push' method.