Hi Manolo,
We have analyzed your queries
Query1: this function "var dataSource = grid.model.currentViewData;" only get the page view data, but if I enable pagin and the chart must show all data, what function do I need?
The currentViewData contains only the data that is present in the current page. When all the data from the datasource needs to be displayed in the chart, then the datasource of the grid needs to be used.
Code example:
[ASPX.cs]
var dataSource= grid.model.dataSource
Screenshot:
The chart rendered when the datasource is binded to grid
Query 2: I need a new chart with summatory total values, I can create a function that browse all records and do the summary manually. My doubt is, if I can get the row summary values instead the manually calculation.
This is not possible to get the summaryRow datas from the grid. We have to calculate that manually.
Query 3: If I enable grouping, the chart is not working
When Grouping is enabled the data will be present only in the grid.model.currentViewData.records
Hence the chart is not rendering.
Now we have set the datasource for chart as below
Code example:
[ASPX.CS]
var dataSource= grid.model.dataSource
The chart is rendered even when the paging option is selected in grid
We have modified and attached the sample below for your reference
Sample link: http://www.syncfusion.com/downloads/support/forum/121078/ze/WebApplication-1263536566
Please let us know if you have any concerns
Regards,
Deepaa.
function onChartCreated(sender) {
chart = $("#" + sender.model.clientId).ejChart("instance");
}
Screenshot:
Onclick of button both the chart and grid are rendered.
We have attached the sample for your reference
http://www.syncfusion.com/downloads/support/forum/121078/ze/WebApplication-956199387
Please let us know if you have any concerns.
Regards,
Deepaa.
if (!dataSource) {
if (grid.model.allowGrouping)
dataSource = grid.model.currentViewData.records;
else
dataSource = grid.model.currentViewData;
}
Screen Shot:
We have modified and attached the sample below for your reference
Sample link:
http://www.syncfusion.com/downloads/support/forum/121078/ze/WebApplication-1055646877
Please let us know if you have any concerns
Regards,
Deepaa
Code Example:
[Aspx.cs]
function onGridActionComplete(sender) {
if (sender.requestType == "filtering") {
if (this.model.filterSettings.filteredColumns.length)
var filteredRecords = this.getFilteredRecords(); //get filtered records
dataSource = null;
bindChartWithGrid(filteredRecords)
}
}
function bindChartWithGrid(filteredRecords) {
// check if grid and chart are loaded
if (grid == undefined || chart == undefined)
return;
if (filteredRecords)
dataSource = filteredRecords;
else if (grid.model.allowGrouping)
dataSource = grid.model.currentViewData.records;
else
dataSource = grid.model.currentViewData;
. . .
}
To know more about the grid filtering please refer the below link
http://help.syncfusion.com/js/api/ejgrid#methods:getfilteredrecords
Screenshot:
When status is set as close in filtering ,the rendered grid and chart are shown below
We have attached the modified sample below
Sample Link: http://www.syncfusion.com/downloads/support/forum/121078/ze/Webapplication596825345
Please let us know if you have any concerns
Regards,
Deepaa.