I'm trying to use Handsontable for some basic editing and number formatting.
The data, including formatting info is fetched from the server and would look similar to this:
var data = [
[ { num:'1.1', color:'red' }, { num:'2.2', color:'green' } ],
[ { num:'3.4', color:'yellow' }, { num:'4.4', color:'blue' } ]
];
Now, I would like to pass this data to my Handsontable and have each cell display/edit the .num values. By using a custom renderer and editor (briefly explained here: Understanding cell functions), I have found a solution that handles manual editing - see this JSFiddle:
http://jsfiddle.net/7akqc87x/5/
However, there are two problems with this solution:
- Pasting values (e.g. from Excel) doesn't work as intended - the pasted values completely overwrite the bound objects instead of updating their
.numproperties. - Numeric validation doesn't work - if I add
type: 'numeric'to thecellProperties, the first edited cell won't exit "edit mode", and no more cells can be edited.
Am I on the right track here? If so, how can I fix these two problems? If not, is there an easier (built-in?) way of binding cells to custom objects?
(I am aware that you can bind an entire row to a custom object - Object data source - but I haven't found a solution for individual cells)