Sets the function that is called when a new page of table data is to be displayed.
The dataFetcher
property is typically used when you are populating
your table with data from an external (non-Wix) data source. You set it
to a function that fetches the data to display.
The function that runs to fetch a new page of data must conform to the following structure:
function rowRetrievalFunction(startRow, endRow) {
return new Promise( (resolve, reject) => {
// Data retrieval code here
if( retrievalSuccess ) {
resolve( {
pageRows: fetchedRows,
totalRowsCount: numRows
} );
}
else {
reject();
}
} );
}
Meaning, your function must:
startRow
the index of the first row to getendRow
the index after the last row to getpageRows
is an array of column:value row datatotalRowsCount
is the number of total rows in all pagesAnother way of populating your table with data programmatically is to
use the rows
property.