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