SMART datagrid v.1 > Examples

[ grids ver.1.3.5]   Back  Forward

Empty Value  Example

In the data field of all types, undefined can be saved together with the value of its data type, and if the value is not consistent with the data type when calling storage function such as insertRow, it will be saved as undefine. At this point, you can specify a proper value in DataSet.nanValue or DataField.nanValue to save it instead of undefined

In addition, when get the values of data row through GridDataSet.getRowObject or display undefined value in the number field cell of the grid, you can also specify the value to be replaced. 

1. nanValue, emptyValue

When save the value in the data set through setValue and insertRow in DataSet.nanValue or nanValue property, you can specify the numeric value saved instead of NaN in NUMBER field. Data field property will take precedence over data set property. 

Grid - 1
0 rows

Change the values of 'Trade' and 'Weight' of focused row as NaN

  Set nanValue of the data set. 

  Set nanValue of 'Weight' field. 

When get the values of the data set through GridDataSet.getRowObject and TreeDataSet.getRowObject, you can specify the value returned instead of undefined through DataField.emptyValue

Remove the value of 'Trade' of focused row through undefined

  Set emptyValue of 'Trade' field. 

Return the current row by JSON object with calling GridDataSet.getRowObject

Return the selected rows by JSON object array with calling GridDataSet.getRowObjects

2. nanText

If the value of the column cell connected to NUMBER field is NaN, you can specify the substitution string which will be displayed in the grid through DisplayOptions.nanText or DataColumn.nanText. The value specified in the column will take precedence. 

Grid - 2
0 rows

Change the values of 'Trade' and 'Weight' of focused row as NaN

  Set DisplayOptions.nanText

  Set DataColumn.nanText of 'Trade' field. 

View Source JSP 

See Also
DataSet.nanValue
DataField.nanValue
DataField.emptyValue
ValueType
GridDataSet.getRowObject
GridDataSet.getRowObjects
GridDataSet.getRowProps
GridDataSet.getRowsProps
DisplayOptions.nanText
DataColumn.nanText
Examples
Number Value