This is a migrated thread and some comments may be shown as answers.

Grid remote data that is processed before display?

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 13 Jul 2012, 02:08 AM

I want to create a grid where the data for the grid comes from a remote datasource but then is re-packaged by a javascript function after the data arrives but before it is displayed (repackaged means some rows are dropped and only some fields are displayed).  The grid needs to show a loading gif (as per usual) while waiting for the remote datasource and javascript function to complete processing.  What is the right way to set this up?   

This sort of thing (below) for example doesn’t work, because the processData() function completes without waiting for the remote datasource to return its data, plus the grid isn’t aware it needs to invoke its loading.gif.

var dataSource = new kendo.data.DataSource({
                        transport: {
                            read: {
                                    url: "REMOTE URL
                                }
                            }
                        }
                    });

function processData() {
    dataSource.read();
    var dataTobeProcessed = dataSource.data();
    ...
    return processedData;
}

$("#grid").kendoGrid({
                        dataSource: {
                            data: processData() 
                        },
                        columns: [ { …} ]
                        
                    })

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 13 Jul 2012, 11:21 AM
Hi Bill,

The place to do some processing of the raw data before it is passed to the DataSource, is schema parse function. The original raw data will be provided as an argument and the function should return the processed data.

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Bill
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or