@(Html.EJ().Grid<Flujo>("Cashflow") .Datasource(ds => ds.Json((IEnumerable<Tupla>)ViewBag.Cuentas).UpdateURL("FlujoUpdate").Adaptor(AdaptorType.RemoteSaveAdaptor)) .CssClass("CustomCss") .AllowMultipleExporting() .ToolbarSettings(toolBar => toolBar.ShowToolbar().ToolbarItems(items => { items.AddTool(ToolBarItems.ExcelExport); })) }) .Columns(col => { col.Field("Empresa").Visible(false).Add(); col.Field("Unidad").Visible(false).Add(); col.Field("Year").Visible(false).Add(); col.Field("SemDesde").Visible(false).Add(); col.Field("SemHasta").Visible(false).Add(); col.Field("CambioUSD").Visible(false).Add(); col.Field("CambioEUR").Visible(false).Add(); col.Field("Key").HeaderText("Semana").IsPrimaryKey(true).TextAlign(TextAlign.Center).Width(75).Add(); col.Field("CXC").HeaderText("Cuentas por Cobrar").Template("#cxcTemplate").TextAlign(TextAlign.Center).AllowEditing(false).Width(110).Add(); col.Field("CXP").HeaderText("Cuentas por Pagar").Template("#cxpTemplate").TextAlign(TextAlign.Center).AllowEditing(false).Width(110).Add(); col.Field("Gastoss").HeaderText("Gastos de Operaciones").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("Bancos").HeaderText("Bancos").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").AllowEditing(false).Add(); col.Field("TotalSemana").HeaderText("Total").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").AllowEditing(false).Add(); }) .Mappers(map => map.ExportToExcelAction("MultipleExportToExcel")) .ClientSideEvents(eve => { eve.TemplateRefresh("template").ActionComplete("complete").ActionBegin("begin").EndEdit("endEdit").ToolbarClick("OnToolbarClick"); }) ) |
@(Html.EJ().Grid<Flujo>("CashflowMX") .Datasource((IEnumerable<Tupla>)ViewBag.CuentasMXN) .Locale("es-MX") .Columns(col => { col.Field("Key").HeaderText("Semana").IsPrimaryKey(true).TextAlign(TextAlign.Center).Width(75).Add(); col.Field("CXC").HeaderText("Cuentas por Cobrar").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("CXP").HeaderText("Cuentas por Pagar").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("Gastoss").HeaderText("Gastos de Operaciones").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("Bancos").HeaderText("Bancos").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("TotalSemana").HeaderText("Total").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); }) ) @(Html.EJ().Grid<Flujo>("CashflowUS") .Datasource((IEnumerable<Tupla>)ViewBag.CuentasUS) .Locale("es-MX") .Columns(col => { col.Field("Key").HeaderText("Semana").IsPrimaryKey(true).TextAlign(TextAlign.Center).Width(75).Add(); col.Field("CXC").HeaderText("Cuentas por Cobrar").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("CXP").HeaderText("Cuentas por Pagar").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("Gastoss").HeaderText("Gastos de Operaciones").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("Bancos").HeaderText("Bancos").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); col.Field("TotalSemana").HeaderText("Total").TextAlign(TextAlign.Center).Width(75).Format("{0:C}").Add(); }) ) |
function OnToolbarClick(args) { if (args.itemName.indexOf("Export") > -1) { //I do this beacuse I need this parameters to filter the datasourse, this filter are extenals to the grids this.model["empresa"] = $("#empresa > option:selected").attr("value"); this.model["unidad"] = $("#account > option:selected").attr("value"); } } |
Queries |
Response | |
“I have a page with three grids, and I want to export all of them.”
|
To export to excel with three grid, use the below code example
| |
“I need to change the font of the excel, colors, etc.” |
To customize the style for the exported grid, use the AutoFormat class. With the autoFormat class, you can provide required color to the grid content, alt row background or border color.
Find the code example:
For more information refer the below document.
| |
“To pass additional Parameter”
|
We have already discussed about this requirement in the below knowledgebase documentation.
Refer the above documentation and still if you face any issue, please get back to us.
|