diff --git a/DatatableJS.Net/DatatableJS.Net.csproj b/DatatableJS.Net/DatatableJS.Net.csproj index 3d56a55..7a281e5 100644 --- a/DatatableJS.Net/DatatableJS.Net.csproj +++ b/DatatableJS.Net/DatatableJS.Net.csproj @@ -12,10 +12,10 @@ git LICENSE.md C#, Helper, Jquery Datatables, Entity Framework, Mvc - Persist search value of individual column with statesave - 3.6.1.0 - 3.6.1.0 - 3.6.1 + Added separated RenderHtml and RenderScript methods as an alternative to Render method. + 3.7.0.0 + 3.7.0.0 + 3.7.0 datatable-js.png true diff --git a/DatatableJS.Net/JSHelper.cs b/DatatableJS.Net/JSHelper.cs index cfa8e9c..83fbdf8 100644 --- a/DatatableJS.Net/JSHelper.cs +++ b/DatatableJS.Net/JSHelper.cs @@ -64,7 +64,7 @@ private static string GetEnumDescription(this Enum enumValue) } /// - /// Render datatable script for prepared grid builder + /// Render both html and script /// /// /// @@ -73,18 +73,28 @@ public static MvcHtmlString Render(this GridBuilder grid) { var html = RenderHtmlString(grid); var script = RenderScriptString(grid); - return new MvcHtmlString(html+script); + return new MvcHtmlString(html + Environment.NewLine + script); } - + /// + /// Render only html + /// + /// + /// + /// public static MvcHtmlString RenderHtml(this GridBuilder grid) { - return new MvcHtmlString(RenderHtmlString(grid)); } + + /// + /// Render only script + /// + /// + /// + /// public static MvcHtmlString RenderScript(this GridBuilder grid) { - return new MvcHtmlString(RenderScriptString(grid)); } @@ -100,8 +110,6 @@ private static string RenderHtmlString(this GridBuilder grid) var tfootInit = string.Empty; - - var html = $@" @@ -116,7 +124,6 @@ private static string RenderHtmlString(this GridBuilder grid) return html; } - private static string RenderScriptString(this GridBuilder grid) { var tfootInit = string.Empty; diff --git a/DatatableJS/DatatableJS.csproj b/DatatableJS/DatatableJS.csproj index b759585..4421d4e 100644 --- a/DatatableJS/DatatableJS.csproj +++ b/DatatableJS/DatatableJS.csproj @@ -12,9 +12,9 @@ https://github.com/ekondur/DatatableJS git C#, Tag Helper, Jquery Datatables, Entity Framework, Mvc, Net Core - Persist search value of individual column with statesave + Added separated RenderHtml and RenderScript methods as an alternative to Render method. Added Dom feature. true - 3.6.1 + 3.7.0 datatable-js.png true diff --git a/DatatableJS/JSHelper.cs b/DatatableJS/JSHelper.cs index aed4367..df49c39 100644 --- a/DatatableJS/JSHelper.cs +++ b/DatatableJS/JSHelper.cs @@ -1,11 +1,8 @@ using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.AspNetCore.Mvc.ViewFeatures; using Newtonsoft.Json; using System; -using System.Collections.Generic; using System.Linq; -using System.Runtime.CompilerServices; namespace DatatableJS { @@ -52,16 +49,22 @@ public static JSHelper JS(this IHtmlHelper helper) } /// - /// Render datatable script for prepared grid builder + /// Render both html and script /// /// /// /// public static IHtmlContent Render(this GridBuilder grid) { - return new HtmlString(RenderHtml(grid).ToString() + RenderScript(grid).ToString()); + return new HtmlString(RenderHtml(grid).ToString() + Environment.NewLine + RenderScript(grid).ToString()); } + /// + /// Render only html + /// + /// + /// + /// public static IHtmlContent RenderHtml(this GridBuilder grid) { var tfoot = grid._columnSearching ? @@ -71,7 +74,6 @@ public static IHtmlContent RenderHtml(this GridBuilder grid) " : string.Empty; - var html = $@"
@@ -82,13 +84,16 @@ public static IHtmlContent RenderHtml(this GridBuilder grid) {tfoot}
"; - - + return new HtmlString(html); } - - + /// + /// Render only script + /// + /// + /// + /// public static IHtmlContent RenderScript(this GridBuilder grid) { var tfootInit = string.Empty; @@ -182,7 +187,6 @@ public static IHtmlContent RenderScript(this GridBuilder grid) $"lengthMenu: {string.Format("[[{0}], [{1}]]", string.Join(", ", grid._lengthMenuValues), string.Join(", ", grid._lengthMenuDisplayedTexts.Select(a => string.Concat(@"""", a, @""""))))}," ; - var script = $@"