Hi Guys,
iam wondering how we can assign a default value to a column cells.
Also, how we can make data type validation
thank peers.
Have you seen this example? Does it answer your qwuestion maybe? http://handsontable.com/demo/prepopulate.html
This to me is hardly acceptable. Googling around, there are several use cases for supplying default values. While I appreciate the flexibility this method allows, it seems extreme to have to write a custom render method and custom beforeChange method that parses all this out just to produce new rows with default data.
I envision a Handsontable property that lets you assign a simple JSON object with the property name and default value. I will make a feature request.
In case someone stumbles over this old thread, like I did:
The best solution to achieve default values for new rows is to use the dataSchema configuration option:
new Handsontable(container, {
data: []
colHeaders: ['ID', 'My Text'],
columns: [
{data: 'id'},
{data: 'myText'}
],
dataSchema: {id: null, myText: 'my default text'}, // <----------
});
Most helpful comment
This to me is hardly acceptable. Googling around, there are several use cases for supplying default values. While I appreciate the flexibility this method allows, it seems extreme to have to write a custom render method and custom beforeChange method that parses all this out just to produce new rows with default data.
I envision a Handsontable property that lets you assign a simple JSON object with the property name and default value. I will make a feature request.