Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling Tabulator cells through a callback function #4462

Open
axel-adragna opened this issue Apr 11, 2024 · 0 comments
Open

Filling Tabulator cells through a callback function #4462

axel-adragna opened this issue Apr 11, 2024 · 0 comments
Labels
Suggested Feature A suggested feature that is waiting review

Comments

@axel-adragna
Copy link

Is your feature request related to a problem? Please describe.
I'd like to fill the table through a callback function that asks for cells values.

Describe the solution you'd like
I've been considering the possibility of using Tabulator in a different way than the conventional one. Specifically, I would like the data to be populated not by providing the table with a predetermined set of data (either during initialization or through an AJAX call), but rather I would like the table to set up an "on-demand" mechanism to request data itself when it needs to be displayed, through a callback function called when the row is visible.
The only information Tabulator should know from the start is the number of rows to display (and of course, the definition of the columns).

Here's an example of what I mean:

// callback function
function getDataCallback(row, col, cell, ...anything) {
    return retrieveDataFromMySource(args);
}

//column definition
{title:"Name", field:"name", getOnDemandData:getDataCallback}

I know that the table is already very efficient in rendering data, so this additional feature could be interesting.

Describe alternatives you've considered
A workaround would be to fill the table with dummy data and then replace it as soon as the row becomes visible. But of course it's not a clean and straightforward solution.

I've been a long-time user of this library, thank you for all the work you put into it 😀

@axel-adragna axel-adragna added the Suggested Feature A suggested feature that is waiting review label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Suggested Feature A suggested feature that is waiting review
Projects
None yet
Development

No branches or pull requests

1 participant