"
DataGridXL 3 Out Now! See what's new→

Default Column Settings

DataGridXL3 has sensible default column settings.

This is the complete default column object:

javascript
{
  width: 100,
  align: "left",
  readOnly: false,
  // type: "text",
  // picker
  picker: undefined,
  pickerOptions: {},
  // functions
  parseFunction: undefined,
  validateFunction: undefined,
  formatFunction: undefined,
  styleFunction: undefined,
  sortFunction: undefined,
  // hideText
  hideText: false
}

width (100)

width takes a pixel value.

align ("left")

align takes a string: "left", "center", "right".

readOnly (false)

Set this property to true to make a column read-only. More here.

type ("text")

A shorthand property that defines sortFunction and styleFunction among others. Default is "text".

picker (undefined)

A function that returns a picker object. More here.

pickerOptions ({})

This property is read by the picker.

parseFunction (undefined)

A function that parses incoming cell values to make sure these are compatible with the column's desired data type. E.g. "TRUE"true.

formatFunction (undefined)

A function that formats the cell value to something easily scannable by the user, e.g. 5020"$5,020".

validateFunction (undefined)

A function that returns true or false depending on the cell value. When false, the background color of the cell changes to red, to inform the user that the value is invalid.

styleFunction (undefined)

A function that returns a style object that contains a backgroundColor property, a valid color string (preferably HEX).

sortFunction (undefined)

A function that defines how the cell values inside the column should be sorted.

If no sortFunction is given, the default sort function is used to sort the column:

javascript
function(a,b){
  return String(a.value).localeCompare(String(b.value));
}

hideText (false)

Set this to true to hide text in the columns. Useful if the column is used to draw graphics.

Generated: 25.01.28 (V3.25.01.22)