Skip to content

Commit 5e648a4

Browse files
author
emrah.kondur
committed
Merge branch 'master' of https://github.com/ekondur/DatatableJS
2 parents 5722e9f + 613a625 commit 5e648a4

File tree

7 files changed

+36
-5
lines changed

7 files changed

+36
-5
lines changed

DatatableJS.Net/Builders/GridBuilder.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class GridBuilder<T>
2929
internal List<int> _lengthMenuValues { get; private set; } = new List<int>();
3030
internal List<string> _lengthMenuDisplayedTexts { get; private set; } = new List<string>();
3131
internal int? _pageLength { get; private set; }
32+
internal bool _processing { get; private set; } = true;
3233

3334
internal List<ColumnDefinition> _columns = new List<ColumnDefinition>();
3435
internal List<FilterDefinition> _filters = new List<FilterDefinition>();
@@ -318,5 +319,16 @@ public GridBuilder<T> PageLength(int value)
318319
}
319320
return this;
320321
}
322+
323+
/// <summary>
324+
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
325+
/// </summary>
326+
/// <param name="processing"></param>
327+
/// <returns></returns>
328+
public GridBuilder<T> Processing(bool processing)
329+
{
330+
_processing = processing;
331+
return this;
332+
}
321333
}
322334
}

DatatableJS.Net/JSHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ public static MvcHtmlString Render<T>(this GridBuilder<T> gridBuilder)
103103
$(document).ready(function () {{
104104
$('#{gridBuilder._name}').DataTable( {{
105105
{tfootInit}
106-
processing:true,
106+
processing:{gridBuilder._processing.ToLowString()},
107107
serverSide:{gridBuilder._serverSide.ToLowString()},
108108
fixedColumns: {{
109-
lJStColumns: {gridBuilder._leftColumns},
109+
leftColumns: {gridBuilder._leftColumns},
110110
rightColumns: {gridBuilder._rightColumns}
111111
}},
112112
order: [{(!gridBuilder._ordering ? string.Empty : string.Join(", ", gridBuilder._orders.Select(a => $@"[{ a.Column}, '{(a.OrderBy == OrderBy.Ascending ? "asc" : "desc")}']")))}],

DatatableJS/Builders/GridBuilder.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public class GridBuilder<T>
2929
internal List<int> _lengthMenuValues { get; private set; } = new List<int>();
3030
internal List<string> _lengthMenuDisplayedTexts { get; private set; } = new List<string>();
3131
internal int? _pageLength { get; private set; }
32+
internal bool _processing { get; private set; } = true;
3233

3334
internal List<ColumnDefinition> _columns = new List<ColumnDefinition>();
3435
internal List<FilterModel> _filters = new List<FilterModel>();
@@ -318,5 +319,16 @@ public GridBuilder<T> PageLength(int value)
318319
}
319320
return this;
320321
}
322+
323+
/// <summary>
324+
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
325+
/// </summary>
326+
/// <param name="processing"></param>
327+
/// <returns></returns>
328+
public GridBuilder<T> Processing(bool processing)
329+
{
330+
_processing = processing;
331+
return this;
332+
}
321333
}
322334
}

DatatableJS/Helpers/GridHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public class GridHelper : TagHelper
2323
/// </summary>
2424
public bool Searching { get; set; } = true;
2525

26+
/// <summary>
27+
/// Enable or disable the display of a 'processing' indicator when the table is being processed, Default is true.
28+
/// </summary>
29+
public bool Processing { get; set; } = true;
30+
2631
/// <summary>
2732
/// Process
2833
/// </summary>
@@ -41,6 +46,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
4146
Name = Name,
4247
Ordering = Ordering,
4348
Searching = Searching,
49+
Processing = Processing
4450
};
4551

4652
context.Items.Add("DataGrid", grid);

DatatableJS/Helpers/RenderHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
2929
var script = $@"
3030
$(document).ready(function () {{
3131
$('#{grid.Name}').DataTable( {{
32-
processing:true,
32+
processing:{grid.Processing.ToLowString()},
3333
serverSide:{grid.DataSource.ServerSide.ToLowString()},
3434
fixedColumns: {{
3535
leftColumns: {grid.FixedColumns?.LeftColumns},

DatatableJS/JSHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public static IHtmlContent Render<T>(this GridBuilder<T> gridBuilder)
9898
$(document).ready(function () {{
9999
$('#{gridBuilder._name}').DataTable( {{
100100
{tfootInit}
101-
processing:true,
101+
processing:{gridBuilder._processing.ToLowString()},
102102
serverSide:{gridBuilder._serverSide.ToLowString()},
103103
fixedColumns: {{
104-
lJStColumns: {gridBuilder._leftColumns},
104+
leftColumns: {gridBuilder._leftColumns},
105105
rightColumns: {gridBuilder._rightColumns}
106106
}},
107107
order: [{(!gridBuilder._ordering ? string.Empty : string.Join(", ", gridBuilder._orders.Select(a => $@"[{ a.Column}, '{(a.OrderBy == OrderBy.Ascending ? "asc" : "desc")}']")))}],

DatatableJS/Models/GridModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public class GridModel
77
public string Name { get; set; }
88
public bool Ordering { get; set; }
99
public bool Searching { get; set; }
10+
public bool Processing { get; set; }
1011

1112
public List<ColumnModel> Columns { get; set; }
1213
public List<FilterModel> Filters { get; set; }

0 commit comments

Comments
 (0)