The values saved in DataSet will be saved according to the data type and range which have been set in DataField. Data types of Data Field are defined in ValueType constant, and they respectively respond to the basic types of JavaScript such as String, Number, Boolean. The value for proceeding the date is saved as JavaScript Date object. And, you can save undefined value in all data types.
Especially in the case of DATETIME field, when request the value through the method like GridDataSet.getValue, it will directly transfer Date object saved in DataSet. You should never directly change Date object which has been returned from the end of getting the value. And, when call data set API, you should never change Date object which has been transferred as parameter. In other words, Date object should be considered as a read-only value within grid module.
Please refer to Data Field help topic about more details on the data field.
From SMART datagrid version 1.3.5, you can create the data field of OBJECT type. You can directly save JSON object in Object field. However, Data Set is not involved in the object structure but only checks whether the object is changed and fire the related event.
In the grid data cell being connected to Object field, it will basically display the value returned from keyPath or keyCallback property which is specified in the corresponding field, and this returned value will be basically used in column sorting and Excel exporting, etc.
In addition, the user cannot directly update the value basically in this data cell, but should save through GridDataSet.setValue or setValueEx with providing separate input system. At this point, the change of JSON object being saved in the data set can only be checked in the object level. In other words, even if get the object saved in the data set (getValue), change the properties and save them again (setValue), change event will not be fired basically. It will be fired only if there is a change to the object itself.
If it is not JSON object when save the data, JSON.parse() will be called, and if problems occur and the input value is string, it will throw an exception.
If copyCallback has not been set in the corresponding column when copy the value to the clipboard, JSON.stringify() will be called to convert to string. And, pasteCallback must be set for paste.
When save the value through GridDataSet.appendRow or GridDataSet.setValue, you can transfer the string differently from the data type of field, and type conversion will be required at this point. Please refer to DataField.datetimeFormat and booleanFormat help topic about how to store type conversion.
Similarly as inputting and outputting the value in DataSet, when display the value in grid data cell, you can enable the user to read more simply, or display with another meaningful value rather than the actual value. At this point, GridStyles.numberFormat, booleanFormat, datetimeFormat properties will be used for each data type. Please refer to each help topic about more details on the types.
Like the display format, when the user input the value through Cell Editor, you can specify the format being converted to the data type of each field from the input text through CellEditor.booleanFormat and datetimeFormat.