āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/1771-technologies/lytenyte/(server-data-loading)/server-data-loading-overview ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
The server data source is the most advanced and capable of all LyteNyte Grid data sources. Partial data loading is necessary when the dataset contains hundreds of thousands or even millions of rows.
When the amount of row data exceeds what is feasible to transfer to a browser at once, a partial data loading solution becomes necessary.
Developers typically choose one of these approaches:
LyteNyte Grid supports all three approaches, but the Server Data Loading guides focus on viewport-based loading. This approach is the most powerful and flexible but also the most complex to implement. LyteNyte Grid handles the client-side code, so developers only need to implement the server logic.
Server Data Loading allows direct interaction with any row in the dataset and provides a consistent view. For example, if a user scrolls to row index 9,500, the grid retrieves that data seamlessly. Operations like pivoting and grouping are natural with the server data source but limited or unintuitive with pagination and infinite scrolling. Server data loading aims to deliver a client-like experience, with the trade-off of network latency.
To enable the server data source, developers must provide LyteNyte Grid with:
dataFetcher function: a function LyteNyte Grid calls to fetch rows from your server.The server data source follows a well defined lifecycle:
<Steps> <Step>When the grid first renders, LyteNyte Grid calls the dataFetcher function with an initial
request payload. At this stage, LyteNyte Grid has no cached view data. The initial response
provides the rowCount and the first rows to display.
LyteNyte Grid tracks which rows are visible. When the view changes, it determines whether to request more data from the server. If necessary, multiple requests may be issued.
</Step> <Step>Some actions require a full view reset and fresh data from the server. This occurs when users sort a column or group rows, as these operations alter the dataset view.
</Step> </Steps>All other operations extend this basic flow. LyteNyte Grid's server data source is advanced and supports many extensions. The simplest example of a server data loading grid is shown below. Read the guides in this section for in depth coverage:
!demo:Basic Server Data="./demos/basic-server-data"
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā