Skip to content

Commit 712fe0c

Browse files
committed
HandleCustomExport now injected with result object
Breaking change
1 parent eb8f3b8 commit 712fe0c

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

Griddly.Mvc/GriddlyResult.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,20 +143,23 @@ public override void ExecuteResult(ControllerContext context)
143143
fileName = fileName.Replace(c, '_');
144144
}
145145

146-
var records = GetAll(sortFields);
147146
if (exportFormat == GriddlyExportFormat.Custom)
148147
{
149-
result = GriddlySettings.HandleCustomExport(records, items);
148+
result = GriddlySettings.HandleCustomExport(this, items);
150149
}
151-
else if (exportFormat == GriddlyExportFormat.Xlsx)
150+
else
152151
{
153-
result = new GriddlyExcelResult<T>(records, settings, fileName, items["exportName"]);
154-
}
155-
else // if (exportFormat == GriddlyExportFormat.Csv || exportFormat == GriddlyExportFormat.Tsv)
156-
{
157-
result = new GriddlyCsvResult<T>(records, settings, fileName, exportFormat.Value, items["exportName"]);
152+
var records = GetAll(sortFields);
153+
if (exportFormat == GriddlyExportFormat.Xlsx)
154+
{
155+
result = new GriddlyExcelResult<T>(records, settings, fileName, items["exportName"]);
156+
}
157+
else // if (exportFormat == GriddlyExportFormat.Csv || exportFormat == GriddlyExportFormat.Tsv)
158+
{
159+
result = new GriddlyCsvResult<T>(records, settings, fileName, exportFormat.Value, items["exportName"]);
160+
}
158161
}
159-
162+
160163
result.ExecuteResult(context);
161164
}
162165
}

Griddly.Mvc/GriddlySettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public abstract class GriddlySettings
3333
/// Defines an event handler for custom export requests.
3434
///
3535
/// First argument is the record set. Second argument is the posted form values.
36-
/// </summary>s
37-
public static Func<IEnumerable, NameValueCollection, ActionResult> HandleCustomExport = null;
36+
/// </summary>
37+
public static Func<GriddlyResult, NameValueCollection, ActionResult> HandleCustomExport = null;
3838
public static Action<GriddlySettings, HtmlHelper> BeforeRender = null;
3939
public static Action<GriddlySettings, ControllerContext> OnGriddlyResultExecuting = null;
4040

0 commit comments

Comments
 (0)