# Input types

The data properties (rows, columns, headers) accept multiple input types by default - array, function, number, promise, object. Some types (for example - string) require configuration options.

# Array

You can assign an array to any data property:

const rows = [
    { field1: 'value1', field2: 'value2', ...}
];    

The array is treated as immutable. To update a record - clone an array and replace the record with a modified copy.

The datagrid applies client-side sorting, filtering and pagination to the array inputs.

# Function

If you assign a callback function to any data properties it will be called during the initialization and each time the sorting, filtering or pagination parameters change.

function rows(params){
    return $.getJSON(url, params);
}

The function can be asyncronous and return an array/object (directly or via promise/thenable).

# Number

You can specify just how many columns or rows you want. The datagrid will create empty objects and let you configure them dynamically in onRow or onColumn events:

const rows = 100;

function onRow(row){
    row.cells.field1 = values[row.index];
}

# String

There is no default processing for the string data type - it is left for configuration options. For example, if you add http option the string input will be interpreted as a URL:

const options = [
    http()
];

const rows = 'https://example.com/api/data';

# Promise

You can also assign the promise resolving to array/object/number -

const rows = fetch('https://example.com/api/data');