Handsontable-developer Guide-cell function

Source: Internet
Author: User

Renderer

The data presented does not come from the data source, but the DOM and other information is first passed to renderer and then presented.

Five kinds of display function textrenderer:defaultnumericrendererautocompleterenderercheckboxrendererpasswordrenderer

The reason why I can't add listener to cell: 1, a cell will call renderer multiple times, may cause it to have multiple identical event listeners, 2, cell CRUD scrolling, may cause cell and listener binding error. If you must do this, you need to put the cell content in the Div, and the Div plus the listener

Renderer functions as fast and concise as possible

Editor

Validator

It can be a function or a regex; validator does not need to be defined for each element, as compared to renderer and editor.

Renderer,editor,validator are interconnected.

Handsontable defines some type to serialize these three functions, with the following benefits:

var hot = new Handsontable (document.getElementById (' container '), {  columns: [    {      renderer: Handsontable.numericrenderer,      Editor:Handsontable.editors.TextEditor,      Validator: Handsontable.numericvalidator    }  ]}); var hot = new Handsontable (document.getElementById (' container '), {  Columns: [    {      type: ' Numeric '    }  ]});

Pre-defined Types

Textnumericdatecheckboxpasswordselectdropdownautocompletehandsontable
function has a higher precedence than type
var hot = new Handsontable (document.getElementById (' container '), { columns: [ { type: ' Numeric ', Validator:customvalidator//Validator function defined elsewhere }]});

//type= ' password ' does not define validator, which is more special than the function.  
var hot = new Handsontable (document.getElementById (' container '), {validator:customvalidator,//Validator function Defined elsewhere columns: [{type: ' Password '}, {}]}), equivalent to var hot = new Handsontable (document.geteleme Ntbyid (' container '), {columns: [{renderer:Handsontable.PasswordRenderer, Editor:Handsontable.editors.Pa Sswordeditor, validator:undefined} {renderer:Handsontable.TextRenderer,//Text cell type is the DEFAU Lt one Editor:Handsontable.editors.TextEditor,//Text cell type is the default one Validator:customvalidator } ]});
Can be defined by a function, and if defined by type, returns undefined
var cellproperties = $ (' #container '). Handsontable (' Getcellmeta ', 0, 0);//Get cell properties for cell [0, 0]cellpropertie S.renderer; Get cell renderercellproperties.editor; Get cell editorcellproperties.validator; Get Cell Validator
can be defined by function or type.
Getcellrenderer (Row, col) getcelleditor (Row, col) getcellvalidator (row, col)

  

Handsontable-developer Guide-cell function

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.