How to do Grid selection when using DataResult and the ASP.NET Core integration?

1 Answer 40 Views
Grid
Ryan
Top achievements
Rank 1
Ryan asked on 22 Oct 2024, 01:26 AM

Hello,

We are migrating some of our bigger Grids to use the ASP.NET Core server-side helpers. On the TypeScript side of the code, with Kendo React, the Grid component is now using the DataResult object returned by the server endpoint.

One of our Grids needs to support row selection. I used to just do this manually using the described method on the documentation, which does not use DataResult. Is there a recommended way of doing selection when using DataResult? Or do I just modify the values field of the DataResult and add a selected field to each item, similar to without DataResult?

For reference, the structure of DataResult is just ...


/**
 * The result of the [process]({% slug api_kendo-data-query_process %}) method applied to a data structure.
 */
export interface DataResult {
    /**
     * The data that will be rendered by the Grid as an array.
     */
    data: any[];
    /**
     * The total number of records that are available.
     */
    total: number;
}

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 22 Oct 2024, 09:25 AM

Hello Ryan,

You can take a look at the following example where selection is integrated with the "process" method and the DataState of the Grid:

In general, the selected items should have their selected field set to "true" in the data passed to the Grid. With the DataResult, the selected items must have their selected field set to true within the inner "data" array. 

 

Regards,
Konstantin Dikov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Ryan
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or