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

[Solved] Multiple grids from a single datasource

4 Answers 1344 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 05 Jul 2013, 09:21 AM
I have created a page with three read only grids on it.  I would like to be able to populate the grids from a single datasource to reduce the number of server requests.  The schemas for the grid are not the same.  

I have tried creating the a single datasource and the allocating the data to the appropriate grid during the 'change' function of the datasource.

My preferred solution would be to to do it at the data schema level ...

    datasetA : [],
   datasetB: [], 
   success: true
}

Then divide up the data in the change event of the
datasource.change: function()
{
    oDataA = new kendo.data.DataSource(this, {schema: {data: "datasetA"}});
    $("#gridA").data("kendoGrid").setDataSource(oDataA);  
    oDataB = new kendo.data.DataSource(this, {schema: {data: "datasetB"}})
    $("#gridA").data("kendoGrid").setDataSource(oDataB);
}

This doesn't work !
So I tried to move the data into a single data schema ...
 data : [{
    datasetA : [],
    datasetB: []
 }]
 success: true
}

And extracted the data to set the grid data sources ...
datasource.change : function()
{
    $("#gridA").data("kendoGrid").setDataSource(this.at(0).datasetA);
    $("#gridB").data("kendoGrid").setDataSource(this.at(0).datasetB);
}

Which didn't work ...  I have also look at using filters to achieve the desired result be have not been able to get that to work.

What would be the best way to populate several grids from a single datasource ?

Thank you for you help.  

4 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 09 Jul 2013, 09:21 AM
Hi Stephen,

Basically the desired behavior would require custom solution which is out-of-scope of our support service as it covers the build-in functionality only, however I created small jsBin example which you can use as a baseline to achieve the desired behavior. 

Kind Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
khalil
Top achievements
Rank 1
answered on 30 Sep 2014, 02:23 PM
Hi,

Both grids binded to the same table at the previous example,
If the http://demos.kendoui.com/service/Northwind.svc/Orders returns to table first is the customer and the second is the orders,
then how it can be done ?
0
Vladimir Iliev
Telerik team
answered on 02 Oct 2014, 08:52 AM
Hi Khalil,

I'm not sure that I understand correctly what response comes from the server - could you please provide example of how the server response would be formatted?

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
khalil
Top achievements
Rank 1
answered on 02 Oct 2014, 02:03 PM
Thnx,

Anthony sent to me the sample http://dojo.telerik.com/@bergenhem/otoy.
Tags
Grid
Asked by
Stephen
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
khalil
Top achievements
Rank 1
Share this question
or