How to Create a grid

Source: Internet
Author: User

// JS entry

Ext. onready (function (){

// Create table data

VaR DATA = [


['1', 'name1', 'scn1 '],


['2', 'name2', 'scn2 '],


['3', 'name3', 'desc3'],


['4', 'name4', 'scn4 '],


['5', 'name5', 'desc5']


];

// Specify the data field

VaR store = new Ext. Data. Store ({

Proxy: New
Ext. Data. memoryproxy (data), // method for obtaining data

Reader: New
Ext. Data. arrayreader ({}, [// arrayreader parses the Array

{Name: 'id '},

{Name: 'name '},

{Name: 'desc '}

])


});


Store. Load (); // data Initialization

// Create a Grid Object

VaR grid = new Ext. Grid. gridpanel ({

Autoheight: True,

Renderto: 'grid', // the place to render

Enablecolumnmove: false, // sets whether to drag and drop columns.

Enablecolumnresize: false, // sets whether the column size can be changed.

Striperows: True, // zebra Effect

Store: store,

CM: cm,

Autoexpandcolumn: 'desc', // you can specify the column width to automatically stretch. Only one column ID can be specified.

Viewconfig :{

Forcefit: True // each column is automatically filled with Grid

}

});


}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.