Ext. grid. GridPanel | attribute | method | Configuration | details

Source: Internet
Author: User
[Go to] Ext Grid Control Configuration and Method

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: Indicates whether to hide columns. The default value is false.
Fixed: Specifies whether the column width is fixed. The default value is false.
MenuDisabled: Specifies whether to disable the context menu of a 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: the original value of the data.
Metadata: metadata object, used to set the style and attributes of cells. The object contains the following attributes:
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 a cell
Store: DataSet object
Xtype: Specifies the column Renderer type. The default value is gridcolumn. Other optional values include booleancolumn, numbercolumn, datecolumn, and templatecolumn.
Editable: whether to edit. The default value is true.
Editor: 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 Methods:
FindColumnIndex (String col): queries the column index based on the given dataIndex
GetColumnById (String id): Get the column corresponding to the specified id
GetColumnCount (Boolean visibleOnly): obtains the total number of columns.
GetColumnHeader (Number col): Get the column header
GetColumnId (Number index): obtains the column id.
GetDataIndex (Number col): obtains the data field name corresponding to the column.
GetIndexById (String id): obtains 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: the descending text description in the table Title menu.
ColumnsText: text description of the columns in the table Title menu
AutoFill: whether to automatically expand columns 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 Methods:
FocusCell (Number row, Number col): Move the focus to the specified Cell
FocusRow (Number row): Move the focus to the specified row
GetCell (Number row, Number col): obtains the td element of the specified cell.
GetHeaderCell (Number index): obtains the td element corresponding to the specified header.
GetRow (Number index): gets the tr element corresponding to the specified row
GetRowClass (Record record, Number index, Object rowParams, Store store): Get the style name appended to the table row.
Record: the data record object of the current row.
Index: index of the current row
RowParams: Specifies the configuration object passed in to the row template during rendering. You can customize a style for the row body. This object takes effect only when enableRowBody is set to true. The possible attributes are as follows:
Body: HTML code snippet rendered to the row body
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 td element of the row body. The default value is the total number of columns.
Store: Table Dataset
Refresh ([Boolean headersToo]): refreshes the table component.
ScrollToTop (): Scroll the table to the top

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: Indicates whether to hide columns. The default value is false.
Fixed: Specifies whether the column width is fixed. The default value is false.
MenuDisabled: Specifies whether to disable the context menu of a 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: the original value of the data.
Metadata: metadata object, used to set the style and attributes of cells. The object contains the following attributes:
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 a cell
Store: DataSet object
Xtype: Specifies the column Renderer type. The default value is gridcolumn. Other optional values include booleancolumn, numbercolumn, datecolumn, and templatecolumn.
Editable: whether to edit. The default value is true.
Editor: 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 Methods:
FindColumnIndex (String col): queries the column index based on the given dataIndex
GetColumnById (String id): Get the column corresponding to the specified id
GetColumnCount (Boolean visibleOnly): obtains the total number of columns.
GetColumnHeader (Number col): Get the column header
GetColumnId (Number index): obtains the column id.
GetDataIndex (Number col): obtains the data field name corresponding to the column.
GetIndexById (String id): obtains 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: the descending text description in the table Title menu.
ColumnsText: text description of the columns in the table Title menu
AutoFill: whether to automatically expand columns 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 Methods:
FocusCell (Number row, Number col): Move the focus to the specified Cell
FocusRow (Number row): Move the focus to the specified row
GetCell (Number row, Number col): obtains the td element of the specified cell.
GetHeaderCell (Number index): obtains the td element corresponding to the specified header.
GetRow (Number index): gets the tr element corresponding to the specified row
GetRowClass (Record record, Number index, Object rowParams, Store store): Get the style name appended to the table row.
Record: the data record object of the current row.
Index: index of the current row
RowParams: Specifies the configuration object passed in to the row template during rendering. You can customize a style for the row body. This object takes effect only when enableRowBody is set to true. The possible attributes are as follows:
Body: HTML code snippet rendered to the row body
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 td element of the row body. The default value is the total number of columns.
Store: Table Dataset
Refresh ([Boolean headersToo]): refreshes the 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.