Skip to content

Commit f8ccc10

Browse files
committed
2 parents a91c250 + 23b544d commit f8ccc10

File tree

6 files changed

+32
-30
lines changed

6 files changed

+32
-30
lines changed

Build/CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
//
1616
// You can specify all the values or you can default the Revision and Build Numbers
1717
// by using the '*' as shown below:
18-
[assembly: AssemblyVersion("1.0.76.0")]
19-
[assembly: AssemblyFileVersion("1.0.76.0")]
18+
[assembly: AssemblyVersion("1.0.77.3")]
19+
[assembly: AssemblyFileVersion("1.0.77.3")]

Griddly.Mvc/GriddlySettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public GriddlySettings()
5858
public string Title { get; set; }
5959
public string ClassName { get; set; }
6060
public string TableClassName { get; set; }
61-
public string OnClientRefresh { get; set; }
6261
public bool ShowFilterInitially { get; set; }
6362
public bool ShowRowSelectCount { get; set; }
6463

Griddly/Scripts/griddly.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
if (this.options.onRefresh)
2424
this.options.onRefresh(this, 0, this.options.count > this.options.pageSize ? this.options.pageSize : this.options.count, this.options.count, null);
2525

26-
// TODO: should we remove the onClientRefresh method?
27-
this.$element.trigger("refresh",
26+
this.$element.trigger("init.griddly", this.$element,
2827
{
2928
start: 0,
3029
pageSize: this.options.count > this.options.pageSize ? this.options.pageSize : this.options.count,
@@ -567,6 +566,8 @@
567566

568567
$(".griddly-filters-inline input, .griddly-filters-inline select", this.$element).on("change", $.proxy(function (event)
569568
{
569+
this.$element.trigger("filterchange.griddly", this.$element, event.target);
570+
570571
if (this.options.autoRefreshOnFilter)
571572
this.refresh(true);
572573
}, this));
@@ -751,6 +752,8 @@
751752

752753
refresh: function(resetPage)
753754
{
755+
this.$element.trigger("beforerefresh.griddly", this.$element);
756+
754757
if (!this.options.url)
755758
{
756759
window.location = window.location;
@@ -811,19 +814,15 @@
811814
else
812815
this.$element.find(".griddly-pager").show();
813816

814-
var _this = this;
815817
//iterate through table and check rows that are in the selected list and have a checkbox
818+
var _this = this;
816819
$("tbody tr", this.$element).find("input[name=_rowselect]").each(function (index, e) {
817820
var rowkey = $(e).data("rowkey");
818821
if (_this.options.selectedRows[rowkey])
819822
$(e).prop("checked", true);
820823
});
821824

822-
if (this.options.onRefresh)
823-
this.options.onRefresh(this, startRecord, currentPageSize, count, postData);
824-
825-
// TODO: should we remove the onClientRefresh method?
826-
this.$element.trigger("refresh",
825+
this.$element.trigger("refresh.griddly", this.$element,
827826
{
828827
start: startRecord,
829828
pageSize: currentPageSize,
@@ -844,6 +843,8 @@
844843

845844
window.location = url;
846845
}
846+
847+
this.$element.trigger("error.griddly", this.$element);
847848
}, this));
848849
},
849850

@@ -864,11 +865,6 @@
864865
return result;
865866
},
866867

867-
onRefresh: function(onRefresh)
868-
{
869-
this.options.onRefresh = onRefresh;
870-
},
871-
872868
pageNumber: function(pageNumber)
873869
{
874870
if (pageNumber >= 0 && pageNumber < this.options.pageCount)
@@ -924,7 +920,6 @@
924920
{
925921
pageNumber: 0,
926922
pageSize: 20,
927-
onRefresh: null,
928923
onError: null,
929924
isMultiSort: true,
930925
lastSelectedRow: null,

Griddly/Views/Home/Index.cshtml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,14 @@
8383
{
8484
$(".filter-range-grid").griddly("setFilterValues", { companyStart: '53' });
8585
}
86-
</script>
86+
</script>
87+
88+
@section scripts{
89+
<script>
90+
//$(".test-grid").on("beforerefresh.griddly", function ()
91+
//{
92+
// alert("It's not minty fresh!");
93+
// return false;
94+
//});
95+
</script>
96+
}

Griddly/Views/Home/TestGrid.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
{
88
PageSize = 5,
99
ShowRowSelectCount = true,
10+
ClassName = "test-grid"
1011
}
1112
.SelectColumn(x => x.Id)
1213
.RowId(x => x.FirstName)

Griddly/Views/Shared/Griddly/Griddly.cshtml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
@: @Html.AttributeNullable("data-griddly-url", !simple ? Url.Current() : null)
5252
@: data-griddly-count="@Model.Total"
5353
@: data-griddly-pagesize="@(settings.PageSize ?? Model.PageSize)"
54-
@: @Html.AttributeNullable("data-griddly-onrefresh", settings.OnClientRefresh)
5554
@: @Html.AttributeNullable("data-griddly-rowclickmodal", settings.RowClickModal)
5655
@: data-griddly-defaultrowids="@Json.Encode(settings.DefaultRowIds != null ? settings.DefaultRowIds.Select(x => x.ToLower()).ToArray() : new[] { "value" })"
5756
@: @Html.AttributeIf("data-griddly-defaultsort", defaultSort != null && defaultSort.Any(), Html.AttributeEncode(Json.Encode(defaultSort.Select(x => new { Field = x.Field, Direction = x.Direction.ToString() }))))>
@@ -83,17 +82,6 @@
8382
<td colspan="@settings.Columns.Count">@settings.Title</td>
8483
</tr>
8584
}
86-
87-
@if (settings.ShowRowSelectCount)
88-
{
89-
<tr class="griddly-selection header" style="display:none;">
90-
<td colspan="@settings.Columns.Count">
91-
<span><label class="griddly-selection-count">0</label> rows selected</span>
92-
<span><a class="griddly-selection-clear" href="javascript:;">Clear</a></span>
93-
</td>
94-
</tr>
95-
}
96-
9785
<tr class="griddly-filters" style="@(settings.FilterTemplate == null || !settings.ShowFilterInitially ? "display:none" : null)">
9886
<td colspan="@settings.Columns.Count">
9987
<form class="filterForm novalidate">
@@ -133,6 +121,15 @@
133121
{
134122
<tr class="griddly-filters griddly-filters-inline">@settings.InlineFilterTemplate(settings)</tr>
135123
}
124+
@if (settings.ShowRowSelectCount)
125+
{
126+
<tr class="griddly-selection" style="display:none;">
127+
<td colspan="@settings.Columns.Count">
128+
<span><label class="griddly-selection-count">0</label> rows selected</span>
129+
<span><a class="griddly-selection-clear" href="javascript:;">Clear</a></span>
130+
</td>
131+
</tr>
132+
}
136133
</thead>
137134
}
138135
<tbody class="data">

0 commit comments

Comments
 (0)