Click here to Skip to main content
15,885,914 members
Articles / AngularJs

Dock Panel for Angular.js

Rate me:
Please Sign up or sign in to vote.
4.80/5 (7 votes)
3 Sep 2015Apache1 min read 20.2K   5   2
Dock panel for Angular.js

It sounds unbelievable, but modern HTML applications seem to lack proper support for dock panels. So, I created one for Angular.js.

ngdocksample

My solution is based on ngDock by Dardino, with a number of changes:

  • Added support for hiding and showing the docked panels: existing ngDock gets thoroughly confused in this case, due to the way Angular processes ng-show directives.
  • Allowed specifying dock=”top” instead of dock=”‘top'”
  • Changed names of some variables to make the intent more clear
  • Removed resizable dock panels (sorry); I could not make them work quickly, and our app does not need this functionality

Dock panel is a fundamental UI element that allows to define headers, footers and side bars. It exists in many UI frameworks, from GTK to WPF. The simplest docked design looks like this:

headerview

It is possible to define such design in standard CSS if the header has a fixed height. But if there is no fixed height, or if the headers may be shown and hidden during the life of the application, it seems to be impossible to do in CSS (StackOverflow article), unless you are willing to use flexible boxes. There are no flexible boxes in our application and I did not want to introduce them, because this seems like a big change, and I am not entirely certain about the quality of the flexible boxes support in our target browsers.

Besides the aforementioned ngDock, I also found a jQuery DockPanel plugin, but its sample says it must be initialized with fixed width and height, and it did not look good.

So, I took the ngDock code and modified it to suit my needs. Feel free to improve on it, and if you do, please let me know by adding a comment to this post.

This article was originally posted at http://www.ikriv.com/blog?p=1687

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Technical Lead Thomson Reuters
United States United States
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.

Please visit my web site: www.ikriv.com.

Comments and Discussions

 
Questionwhy is taged as cpp, mfc, windows? Pin
vvidov6-Sep-15 20:19
professionalvvidov6-Sep-15 20:19 
AnswerRe: why is taged as cpp, mfc, windows? Pin
Ivan Krivyakov10-Sep-15 15:43
Ivan Krivyakov10-Sep-15 15:43 
Not sure. I only see "AngularJS" in tags.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.