EXT Grid Control Configuration and Method

Source: Internet
Author: User

1. Ext. Grid. gridpanel
Main configuration items:
Store: Table Dataset
Columns: configuration array of table column mode. columnmodel column mode can be automatically created.
Autoexpandcolumn: automatically fills the columns that are not used in the table. The parameter is the column ID, and the ID cannot be 0.
Striperows: whether the table is color-changing across rows. The default value is false.
Cm and colmodel: the column mode of the table. This configuration item must be set during table rendering.
SM and selmodel: Table selection mode. The default value is Ext. Grid. rowselectionmodel.
Enablehdmenu: whether to display the context menu of the header. The default value is true.
Enablecolumnhide: whether to allow columns to be hidden from the context menu in the title. The default value is true.
Loadmask: whether to display the mask effect when loading data. The default value is false.
View: Table view. The default value is Ext. Grid. gridview.
Viewconfig: configuration object of table View
Autoexpandmax: the maximum width of the automatically expanded column. The default value is 1000.
Autoexpandmin: The minimum width of the automatically expanded column. The default value is 50.
Columnlines: whether to display the column segmentation line. The default value is false.
Disableselection: whether to disable row selection. The default value is false.
Enablecolumnmove: whether to allow drag and drop columns. The default value is true.
Enablecolumnresize: whether to change the column width. The default value is true.
Hideheaders: Indicates whether to hide the header. The default value is false.
Maxheight: maximum height
Mincolumnwidth: Minimum column width. The default value is 25.
Trackmouseover: whether to highlight the row where the mouse is located. The default value is true.
Main Methods:
Getcolumnmodel (): obtains the column mode.
Getselectionmodel (): gets the selection mode
Getstore (): Get a dataset
Getview (): Get view object
Reconfigure (ext. Data. Store, ext. Grid. columnmodel colmodel): reconfigure the table component using a new dataset and column mode.

2. Ext. grid. column
main configuration items:
ID: column id
header: Header text
dataindex: set the correspondence between columns and data records in the dataset. The value is the field name in the data record. If this item is not set, the column index is used to match the index of the field in the data record
width: column width
align: Align of column data
hidden: whether to hide a column. The default value is false.
fixed: whether to fix the column width. The default value is false.
menudisabled: whether to disable the context menu of the column. The default value is false.
resizable: whether to change the column width. The default value is true.
sortable: whether to allow sorting. The default value is true.
Renderer: set the column's custom cell rendering function
the input function parameters include:
value: original data value
metadata: Metadata object, set the style and attribute of a cell. The attributes of this object include:
CSS: The style name applied to the TD element of the cell
ATTR: an HTML attribute definition string, for example, 'style = "color: Blue" '
record: Current Data Record object
rowindex: Row index of cells
colindex: column index of cells
store: DataSet object
xtype: column Renderer type. The default value is gridcolumn, other optional values include booleancolumn, numbercolumn, datecolumn, and templatecolumn.
Editable: editable or not. The default value is true.
Editor:
groupname:
emptygrouptext:
groupable:

3. Ext. grid. columnmodel
main configuration items:
columns: field array
defaultsortable: whether to sort data by default. The default value is false.
defaultwidth: default width
main method:
findcolumnindex (string col): query the column index based on the given dataindex
getcolumnbyid (string ID ): get the column corresponding to the specified id
getcolumncount (Boolean visibleonly): Get the total number of columns
getcolumnheader (number col): Get the column header
getcolumnid (number index ): get the column id
getdataindex (number col): Get the data field name of the column
getindexbyid (string ID): Get the column index
gettotalwidth (Boolean includehidden)
iscelleditable (number colindex, number rowindex)
isfixed ()
ishidden (number colindex)
setcolumnheader (number Col, string header)
setcolumnwidth (number Col, number width, Boolean suppressevent)
setdataindex (number Col, string dataindex)
seteditable (number Col, Boolean editable)
seteditor (number Col, object Editor)
sethidden (number colindex, Boolean hidden)
setrenderer (number Col, function FN)

4. Ext. Grid. abstractselectionmodel
Main Methods:
Lock (): Lock the selected region
Unlock (): Unlock the selected region
Islocked (): whether the selected region is locked

5. Ext. Grid. cellselectionmodel
Main Methods:
Clearselections (Boolean preventnotify): clears the selected region.
Getselectedcell (): gets the selected cell and returns an array in the format of [rowindex, colindex]
Hasselection (): whether the selected region exists.
Select (number rowindex, number colindex, [Boolean preventviewnotify], [Boolean preventfocus], [Ext. Data. Record R]): select the specified Cell

6. Ext. Grid. rowselectionmodel
Main configuration items:
Singleselect: whether to use the single-choice mode. The default value is false. Multiple data entries can be selected.
Main Methods:
Clearselections ([Boolean fast]): clears all selected regions
Deselectrange (number startrow, number endrow): cancels row selection within the range
Deselectrow (number row, [Boolean preventviewnotify]): cancels the selection status of the specified row.
Each (function FN, [object scope]): traverses all selected rows and calls the specified function. The currently selected row is passed in to this function.
Getcount (): Get the total number of rows selected
Getselected (): Get the first selected record.
Getselections (): Get the array of all selected records
Hasnext (): determines whether there are records to be selected after the selected row
Hasprevious (): determines whether there are records to be selected before the selected row
Hasselection (): whether data is selected
Isidselected (string ID): determines whether the record with the specified ID is selected
Isselected (number/record index): determines whether the data of the specified record or record index is selected
Selectall (): select all rows
Selectfirstrow (): select the first row
Selectlastrow ([Boolean keepexisting]): select the last row.
Keepexisting: whether to retain existing options
Selectnext ([Boolean keepexisting]): select the next row of the currently selected row
Selectprevious ([Boolean keepexisting]): select the previous row of the currently selected row
Selectrange (number startrow, number endrow, [Boolean keepexisting]): select all rows in the range
Selectrecords (Array records, [Boolean keepexisting]): select a group of specified records.
Selectrow (number row, [Boolean keepexisting], [Boolean preventview1_y]): select a row
Row: Row Index
Selectrows (array rows, [Boolean keepexisting]): Select multiple rows.
Rows: Row Index Array

7. Ext. Grid. checkboxselectionmodel
Main configuration items:
Singleselect: whether to use the single-choice mode. The default value is false. Multiple data entries can be selected.
Checkonly: whether to select only by clicking the checkbox column. The default value is false.
Sortable: whether to allow sorting of checkbox columns. The default value is false.
Width: the width of the checkbox column. The default value is 20.

8. Ext. Grid. rownumberer
Main configuration items:
Header: content displayed in the line number list Header
Width: column width. The default value is 23.

9. Ext. grid. gridview
main configuration items:
enablerowbody: whether the row body is included
sortasctext: the ascending text description in the table Title menu
sortdesctext: descending text description in the table Title menu
columnstext: text description corresponding to the column in the table Title menu
AutoFill: whether to automatically expand the column to fill the entire table, the default value is false
forcefit: whether to force adjust the table column width to apply the overall width of the table to prevent horizontal scroll bars. The default value is false.
main method:
focuscell (number row, number col): Move focus to the specified cell
focusrow (number row): Move focus to the specified row
getcell (number row, number col): Get the TD element corresponding to the specified cell
getheadercell (number index): Get the TD element corresponding to the specified header
getrow (number index ): get the tr element of the specified row
getrowclass (record, number index, object rowparams, store): Obtain the style name appended to the table row
record: the data record object of the current row
index: Index of the current row
rowparams: the configuration object passed in to the row template during rendering, through which you can customize the style for the row body, this object takes effect only when enablerowbody is true. The possible attributes are as follows:
body: HTML Code snippet
bodystyle: String applied to the style attribute of the tr element of the row body
Cols: the value applied to the colspan attribute of the row body TD element. The default value is the total number of columns
store: Table dataset
refresh ([Boolean headerstoo]): refresh table component
scrolltotop (): Scroll the table to the top

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.