Handsontable Action on a cell

Source: Internet
Author: User

1. Automatically populate cell data

Fillhandle:true/false//When value is true, allows dragging the lower-right corner of the cell to automatically populate the selected cell with its values


2. Merging cells

Mergecells:[{row: Starting number of rows, cols: Number of starting columns, rowspan: Number of rows merged, colspan: Number of columns merged},...]


3. Initialize the alignment of cells or columns

Horizontal style: Htleft,htcenter,htright,htjustify

Vertical style: Httop,htmiddle,htbottom


4. read-only mode

Column read-only, setting column properties: Readonly:true

Cell Read Only: Cellproperties.readonly = True


5. Set the editing type of the cell

Columns:[{type: Type}]

The main types are:

Text: string

Numeric: Number Type

Date: Day box

CheckBox: Radio Box

Password: Password box


The following types of use are more special

Select: Drop-down editor

columns:[

{editor: ' SELECT ',

selectoption:[option 1, option 2, ...]},

.......

]


Dropdown: drop-down selection

columns:[

{type: ' dropdown ',

source:[option 1, option 2, ...]},

......

]


AutoComplete: auto-match mode

columns:[

{type: 'AutoComplete ',

source:[option 1, option 2, ...],

Strict:true/false,//value true, exact match

Allowinvalid:true/false//value is true, the input value is allowed as a match and can only be used when strict is true

},

......

]


Handsontable: Tabular mode

columns:[

{type: 'handsontable ',

handsontable:{...},

......

]


Custom mode

data=[{

Title:html label,

Description: Description,

Comments: Reviews,

Cover: Cover

},

......

]


Custom boundaries

customborders:[

range:{

Form:{row: Number of rows, col: number of columns},//Start column

To:{row: Number of rows, col: number of columns},//Terminating column

top/bottom/right/left:{//up/down right left line

Width: number of images,

Color: Colors

}

}

]


6. Query the value of the cell

Querying a cell's value requires 3 steps:

A. Setting the Hot property search to True

B. Creating a comparison function

C. Rendering comparison results

The sample code is as follows:

[JavaScript]View Plaincopyprint?
  1. Var
  2. data = [
  3. [' Nissan ', ', ' black ', ' black '],
  4. [' Nissan ', ', ' Blue ', ' Blue '],
  5. [' Chrysler ', ' yellow ', ' Black '],
  6. [' Volvo ', ' Yellow ', ' Gray ']
  7. ],
  8. Example = document.getElementById (' example1 '),
  9. searchfiled = document.getElementById (' Search_field '),
  10. Hot
  11. Hot = New Handsontable (example, {
  12. Data:data,
  13. Colheaders: True,
  14. Search: True
  15. });
  16. function Onlyexactmatch (querystr, value) {
  17. return querystr.tostring () = = = Value.tostring ();
  18. }
  19. Handsontable.Dom.addEvent (searchfiled, ' keyup ', function (event) {
  20. var queryresult = hot.search.query (this.value);
  21. Console.log (QueryResult);
  22. Hot.render ();
  23. });

7. Comments

Comments:true/false//value is true when comments can be displayed, and the right-click menu can be added to delete comments.

When the value is true, you can set the cell's comment content in the following format:

cell:[

{

Row: Number of rows,

Col: Number of columns,

Comment: Comment content

}

]

Handsontable Action on a cell

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.