dataFetcher


dataFetcherFunction

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:

  • Take in two parameters:
    • startRow the index of the first row to get
    • endRow the index after the last row to get
  • Return a Promise which:
    • Either resolves to an object with the following properties:
      • pageRows is an array of column:value row data
      • totalRowsCount is the number of total rows in all pages
    • Or rejects

Another way of populating your table with data programmatically is to use the rows property.

Was this helpful?
Yes
No