LyteNyte Grid logo for light mode. Links back to the documentation home page.
Server Data Loading

Data Pushing or Pulling

Control data loading with the server data source and use hybrid patterns where row data comes from both the client and the server.

Pulling Data

Use the pushRequests method on the server data source to manually trigger server data fetches. Calling this method bypasses existing request tracking and processes these requests as new. The grid resolves row data conflicts and cancels pending requests if the grid resets before the server responds.

Click the Request Data button in the demo below to manually refresh the grid, simulating a user-triggered polling update.

Server Data Pulling

Fork code on stack blitzFork code on code sandbox

The Request Data button’s onClick callback handles the server data fetch:

<button
onClick={() => {
ds.pushRequests(ds.requestsForView.get());
}}
>
Request Data
</button>

The demo uses the requestsForView atom to fetch data for the current view, though any request set can be used. If you’re unfamiliar with the request interface, see the Data Interface guide for more details.

Pushing Data

Use pushResponses on the server data source to push data into LyteNyte Grid. It accepts complete data responses and applies them to the data source. You can also generate client-side updates and push them as simulated server responses, as demonstrated below.

Server Data Pushing

Fork code on stack blitzFork code on code sandbox

This example is intentionally simple to highlight the core functionality. Like the data-pulling example, the main logic runs in the Push Data button’s onClick handler. However, instead of calling pushRequests, it calls pushResponses and provides complete responses.

<button
onClick={() => {
const res = getResponses(
ds.requestsForView.get(),
grid.state.rowGroupModel.get(),
grid.state.aggModel.get(),
);
ds.pushResponses(res);
}}
>
Push Data
</button>

Pushing responses requires understanding the server data source response model and how responses form the data tree. For details, see the Data Interface guide.

Next Steps