- Home
- Forum
- ASP.NET Core - EJ 2
- Pivot Table add custom params
Pivot Table add custom params
Hi, I would like pass params on PivotTable like I do on Grid. How can I do that?
This is my code:
JavaScript
--------------------------------
function filtrar(nif,anio) {
var gridObj = document.getElementById("Grid").ej2_instances[0];
var pivotTableObj = document.getElementById("PivotView").ej2_instances[0];
gridObj.query = new ej.data.Query().addParams('custom', {
IdEmpresa: nif,
Anio: anio
});
pivotTableObj.dataSourceSettings.dataSource.adaptor.addParams('custom', {
IdEmpresa: nif,
Anio: anio
});
pivotTableObj.refresh();
gridObj.refresh();
}
C#
--------------------------------
public JsonResult OnPostDataSource([FromBody]SearchAdvancedFilterDto dm)
{
CustomFilter customFilter = new CustomFilter();
if (dm != null && dm.Custom != null) { customFilter = dm.Custom; }
var sql = "exec spGetPYGCliente {0},{1},{2},{3};";
var d = (_Context.ListadoPyG.FromSql(sql, $"nif={customFilter.IdEmpresa} " +
$"and anio={customFilter.Anio}"
, User.Identity.Name, 1, 0).ToList());
var listadoPyG = d.AsEnumerable();
var resultJson = new JsonResult(new { result = listadoPyG, count = listadoPyG.Count() });
return dm.RequiresCounts ? resultJson : new JsonResult(listadoPyG);
}
Thanks
SIGN IN To post a reply.
3 Replies
SN
Sivamathi Natarajan
Syncfusion Team
April 15, 2020 02:30 PM UTC
Hi Rubén Valentín,
Thanks for contacting Syncfusion support.
Could you please explain about the purpose of the code and exact requirement? So, that we will provide you to achieve the same in optimized way.
Regards,
Sivamathi.
RV
Rubén Valentín
April 16, 2020 09:09 AM UTC
I have two text box and one button that execute the funtion Filtrar(Filter -javascript).
The filter send to code behind(OnPostDataSource -C#) the custom data(info on textbox) and the result is the datasource to Grid and Pivot Table.
The Grid is working, but I can use the Pivot Table with this tecnic.
The idea on Grid is that:
gridObj.query = new ej.data.Query().addParams('custom', {
IdEmpresa: nif,
Anio: anio
});
This is ok, but this the way to do the same on Pivot Table :
pivotTableObj.dataSourceSettings.dataSource.adaptor.addParams('custom', {
IdEmpresa: nif,
Anio: anio
});
Is not working.
On another hand I´m trying to export pdf the grid, but the export is empty. Note all colunm are templates.
Do you know why happen that?
Thanks.
SN
Sivamathi Natarajan
Syncfusion Team
April 17, 2020 01:37 PM UTC
Please find the below response,
--------------------
|
Query |
Response | |
|
Pivot Table add custom params |
You can add the custom parameters in pivot table using following code example.
Code Example:
Meanwhile, we have prepared a sample to add custom parameters in external button click. Please check the below sample for your reference.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Grid_razor_2.21615015802
| |
|
On another hand I´m trying to export pdf the grid, but the export is empty. Note all colunm are templates |
Currently EJ2 Grid don’t have support exporting with column template. |
Please let us know if you have concern.
Regards,
Sivamathi.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
RV Rubén Valentín
- Apr 14, 2020 09:25 AM UTC
- Apr 17, 2020 01:37 PM UTC