Click here to Skip to main content
15,884,472 members
Articles / jQuery
Tip/Trick

Resizing grid when window is resized

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
18 Nov 2011CPOL 20.3K   6   2
How to resize a grid when browser window resizes.

In order to resize a grid when the browser window changes its size, you can subscribe to the window.onresize event using jQuery.


Here is an example:


JavaScript
$(window).resize(function() {
    
    $(#grid).height($(window).height());
    $(#grid).width($(window).width());
});

If you want to do the same using ExtJs framework, please see this link
http://myextjs.blogspot.com/2011/11/resize-window-resize-grid.html[^].

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Superderivatives
Israel Israel
I’m a .net architect, focusing mainly on
writing a scalable components, My expertise is designing for optimal performance and scalability. Always in search
of new knowledge and ambitions.

Specialties
Design Patterns, UML, OOP/OOD, .NET, C#, C++, STL, ATL, COM/COM+, VB/VB.NET, IIS, ISAPI,ASP/ASP.NET, WebServices, WCF,HTML/JavaScript, Ajax, XML/XSL/XSD, SQL

Personal blog gregnozik.blogspot.com

Comments and Discussions

 
SuggestionResizing grid when Dialog or popup is resized Pin
Member 37365325-Jan-13 8:16
Member 37365325-Jan-13 8:16 
GeneralReason for my vote of 5 so simple Pin
itaitai26-Nov-11 22:11
professionalitaitai26-Nov-11 22:11 

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.