JavaScript
  Home arrow JavaScript arrow Page 3 - EXT JS Passing Live Data
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

EXT JS Passing Live Data
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 3
    2009-07-27

    Table of Contents:
  • EXT JS Passing Live Data
  • MySQL
  • Adding Additional Configuration Properties
  • Working More Closely with the Back End

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    EXT JS Passing Live Data - Adding Additional Configuration Properties


    (Page 3 of 4 )

    If you mouse over one of the grid headings you’ll see a drop-down appear. In the menu that opens when a drop-down is clicked, there is the option to show or hide any column, but the sortable options are grayed out. Enabling these is very easy and can be achieved with just one line of code. In gridExample.html add the following line of code directly after the ColumnModel code:


    //allow column sorting

    cm.defaultSortable = true;


    This property causes all columns in the grid to be sortable. If we don’t want all of the columns to be sortable, we can enable sorting on selected columns by setting the sortable property to true on individual columns. Now when you run the page, you should be able to sort any column in either ascending or descending order:



    There are a huge range of configurable properties that the ColumnModel can make use of in order to control the behavior of the columns. By default the columns are all resizable; to switch off this feature we can set the resizable property to false on each existing column definition:


    //define the columns

    var cm = new Ext.grid.ColumnModel([{

    header:"Title",

    dataIndex:"title",

    width:170,

    resizable:false

    },{

    header:"Image",

    dataIndex:"image",

    width:170,

    resizable:false

    },{

    header:"In-Stock?",

    dataIndex:"inStock",

    width:70,

    resizable:false

    },{

    header:"Price",

    dataIndex:"price",

    width:70,

    resizable:false

    },{

    header:"Category",

    dataIndex:"category",

    width:70,

    resizable:false

    },{

    header:"Manufacturer",

    dataIndex:"manufacturer",

    width:129,

    resizable:false

    }]);


    Note that we can’t set all columns to resizable:false in the same way that we could configure all columns to be sortable. The only other general property like this is defaultWidth which will set the width of all columns.

    As well as the properties we have used in this example, we can also make columns editable, hide individual columns, prevent columns from being hidden, set the alignment of the data, set CSS for column cells, disable the drop-down menu and specify tooltips for the column header, among other things.

    There are also a whole range of properties that can be set on the GridPanel as well. For example, we can enable the addition of a load mask, which automatically adds a gray overlay and loading icon to the whole grid while the data is being retrieved. This can be enabled with the loadMask property, which should be added to the existing configuration object:


    var grid = new Ext.grid.GridPanel({

    el:"productGrid",

    width:700,

    height:500,

    title:"Products",

    store:dataStore,

    cm:cm,

    loadMask:true,

    });


    The load mask will probably only be visible to you for a second or so when testing locally, but your visitors will be reassured that something is happening behind the scenes while they wait for the data to be loaded, as this is likely to take longer in a live scenario.

    More JavaScript Articles
    More By Dan Wellman


       · In terms of your PHP, the inbuilt JSON features are actually the easier way of...
     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek