Use Coolit GridPanel JavaScript

Source: Internet
Author: User

Row selection mode:

Js Code

Var rowcount = grid. getSelectionNode (). getSelections ();

You can obtain all selected records. The rowcount is an Array,

For example, to obtain the data of the sex column, the statement is as follows:

Js Code

Var strsex = rowcount. get ('sex ');

Var strsex = rowcount. get ('sex '); cell selection mode

If the following sm attribute is added to the Configuration Attribute of GridPanel

Js Code sm: new Ext. grid. CellSelectionModel ();

Sm: new Ext. grid. CellSelectionModel (); the table selection mode is cell selection mode. When you click, a corresponding cell is selected instead of a row by default. The selection method is as follows:

Js Code

Var cell = grid. getSelectionNode (). getSelectedCell ();

Var cell = grid. getSelectionNode (). getSelectedCell (); the cell records the selected row (cell [0]) and column (cell [1]). you can use the following statement to obtain the cell data.

Js Code

Var colname = grid. getColumnModel (). getDataIndex (cell [1]); // get the column name

Var celldata = grid. getStore (). getAt (cell [0]). get (colname); // get data

Var colname = grid. getColumnModel (). getDataIndex (cell [1]); // get the column name

Var celldata = grid. getStore (). getAt (cell [0]). get (colname); // get data

GetStore (): obtains the dataset of a table.

GetAt (): obtains the cell [0] row of the dataset.

Get (): get the data of colname for this row

 

Grid. getStore (). getCount gets the total number of record rows;

Grid. getStore (). selectRow (I) selected row

 

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.