Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ekondur/DatatableJS
Browse files Browse the repository at this point in the history
  • Loading branch information
emrah.kondur committed Jan 13, 2022
2 parents 5722e9f + 613a625 commit 5e648a4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
12 changes: 12 additions & 0 deletions DatatableJS.Net/Builders/GridBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class GridBuilder<T>
internal List<int> _lengthMenuValues { get; private set; } = new List<int>();
internal List<string> _lengthMenuDisplayedTexts { get; private set; } = new List<string>();
internal int? _pageLength { get; private set; }
internal bool _processing { get; private set; } = true;

internal List<ColumnDefinition> _columns = new List<ColumnDefinition>();
internal List<FilterDefinition> _filters = new List<FilterDefinition>();
Expand Down Expand Up @@ -318,5 +319,16 @@ public GridBuilder<T> PageLength(int value)
}
return this;
}

/// <summary>
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
/// </summary>
/// <param name="processing"></param>
/// <returns></returns>
public GridBuilder<T> Processing(bool processing)
{
_processing = processing;
return this;
}
}
}
4 changes: 2 additions & 2 deletions DatatableJS.Net/JSHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ public static MvcHtmlString Render<T>(this GridBuilder<T> gridBuilder)
$(document).ready(function () {{
$('#{gridBuilder._name}').DataTable( {{
{tfootInit}
processing:true,
processing:{gridBuilder._processing.ToLowString()},
serverSide:{gridBuilder._serverSide.ToLowString()},
fixedColumns: {{
lJStColumns: {gridBuilder._leftColumns},
leftColumns: {gridBuilder._leftColumns},
rightColumns: {gridBuilder._rightColumns}
}},
order: [{(!gridBuilder._ordering ? string.Empty : string.Join(", ", gridBuilder._orders.Select(a => $@"[{ a.Column}, '{(a.OrderBy == OrderBy.Ascending ? "asc" : "desc")}']")))}],
Expand Down
12 changes: 12 additions & 0 deletions DatatableJS/Builders/GridBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class GridBuilder<T>
internal List<int> _lengthMenuValues { get; private set; } = new List<int>();
internal List<string> _lengthMenuDisplayedTexts { get; private set; } = new List<string>();
internal int? _pageLength { get; private set; }
internal bool _processing { get; private set; } = true;

internal List<ColumnDefinition> _columns = new List<ColumnDefinition>();
internal List<FilterModel> _filters = new List<FilterModel>();
Expand Down Expand Up @@ -318,5 +319,16 @@ public GridBuilder<T> PageLength(int value)
}
return this;
}

/// <summary>
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
/// </summary>
/// <param name="processing"></param>
/// <returns></returns>
public GridBuilder<T> Processing(bool processing)
{
_processing = processing;
return this;
}
}
}
6 changes: 6 additions & 0 deletions DatatableJS/Helpers/GridHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public class GridHelper : TagHelper
/// </summary>
public bool Searching { get; set; } = true;

/// <summary>
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
/// </summary>
public bool Processing { get; set; } = true;

/// <summary>
/// Process
/// </summary>
Expand All @@ -41,6 +46,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
Name = Name,
Ordering = Ordering,
Searching = Searching,
Processing = Processing
};

context.Items.Add("DataGrid", grid);
Expand Down
2 changes: 1 addition & 1 deletion DatatableJS/Helpers/RenderHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
var script = $@"
$(document).ready(function () {{
$('#{grid.Name}').DataTable( {{
processing:true,
processing:{grid.Processing.ToLowString()},
serverSide:{grid.DataSource.ServerSide.ToLowString()},
fixedColumns: {{
leftColumns: {grid.FixedColumns?.LeftColumns},
Expand Down
4 changes: 2 additions & 2 deletions DatatableJS/JSHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public static IHtmlContent Render<T>(this GridBuilder<T> gridBuilder)
$(document).ready(function () {{
$('#{gridBuilder._name}').DataTable( {{
{tfootInit}
processing:true,
processing:{gridBuilder._processing.ToLowString()},
serverSide:{gridBuilder._serverSide.ToLowString()},
fixedColumns: {{
lJStColumns: {gridBuilder._leftColumns},
leftColumns: {gridBuilder._leftColumns},
rightColumns: {gridBuilder._rightColumns}
}},
order: [{(!gridBuilder._ordering ? string.Empty : string.Join(", ", gridBuilder._orders.Select(a => $@"[{ a.Column}, '{(a.OrderBy == OrderBy.Ascending ? "asc" : "desc")}']")))}],
Expand Down
1 change: 1 addition & 0 deletions DatatableJS/Models/GridModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public class GridModel
public string Name { get; set; }
public bool Ordering { get; set; }
public bool Searching { get; set; }
public bool Processing { get; set; }

public List<ColumnModel> Columns { get; set; }
public List<FilterModel> Filters { get; set; }
Expand Down

0 comments on commit 5e648a4

Please sign in to comment.