|
356 | 356 | {
|
357 | 357 | var last = $("tbody tr", this.$element).index(this.options.lastSelectedRow);
|
358 | 358 | var first = $("tbody tr", this.$element).index($target.parents("tr"));
|
| 359 | + var newstate = this.options.lastSelectedRow.find("input[name=_rowselect]").prop("checked"); |
359 | 360 |
|
360 | 361 | var start = Math.min(first, last);
|
361 | 362 | var end = Math.max(first, last);
|
362 | 363 |
|
363 |
| - $("tbody tr", this.$element).slice(start, end).find("input[name=_rowselect]").prop("checked", true); |
| 364 | + $("tbody tr", this.$element).slice(start, end).find("input[name=_rowselect]").each(function () { $(this).prop("checked", newstate); setRowSelect($(this)) }); |
364 | 365 | }
|
365 | 366 |
|
366 | 367 | this.options.lastSelectedRow = $target.parents("tr");
|
|
378 | 379 |
|
379 | 380 | $(this.$element).on("click", "thead tr .griddly-selection-clear", $.proxy(function (event)
|
380 | 381 | {
|
381 |
| - this.options.selectedRows = {}; |
382 |
| - |
383 |
| - $("tbody tr", this.$element).find("input[name=_rowselect]").prop("checked", false); |
384 |
| - |
| 382 | + this.clearSelected(); |
385 | 383 | onRowChange();
|
386 |
| - this.setSelectedCount(); |
387 | 384 | }, this));
|
388 | 385 |
|
389 | 386 | $("a.export-xlsx", this.$element).on("click", $.proxy(function (e) {
|
|
893 | 890 | return result;
|
894 | 891 | },
|
895 | 892 |
|
| 893 | + clearSelected: function() |
| 894 | + { |
| 895 | + this.options.selectedRows = {}; |
| 896 | + |
| 897 | + $("tbody tr", this.$element).find("input[name=_rowselect]").prop("checked", false); |
| 898 | + |
| 899 | + this.setSelectedCount(); |
| 900 | + }, |
| 901 | + |
896 | 902 | pageNumber: function(pageNumber)
|
897 | 903 | {
|
898 | 904 | if (pageNumber >= 0 && pageNumber < this.options.pageCount)
|
|
970 | 976 | var onclick = button.data("onclick");
|
971 | 977 | var confirmMessage = button.data("confirm-message");
|
972 | 978 | var enableOnSelection = button.data("enable-on-selection");
|
| 979 | + var clearSelectionOnAction = button.data("clear-selection-on-action"); |
973 | 980 | var rowIds = button.data("rowids");
|
974 | 981 |
|
975 | 982 | if ((typeof confirmMessage === "undefined" || confirm(confirmMessage)))
|
|
993 | 1000 | }
|
994 | 1001 | }
|
995 | 1002 |
|
| 1003 | + if (clearSelectionOnAction) |
| 1004 | + { |
| 1005 | + griddly.griddly("clearSelected"); |
| 1006 | + } |
| 1007 | + |
996 | 1008 | switch (toggle)
|
997 | 1009 | {
|
998 | 1010 | case "ajaxbulk":
|
|
1027 | 1039 |
|
1028 | 1040 | if ($.isFunction(f))
|
1029 | 1041 | {
|
1030 |
| - return f.call(button, rowIds); |
| 1042 | + var result = f.call(button, rowIds); |
| 1043 | + |
| 1044 | + if (clearSelectionOnAction) |
| 1045 | + { |
| 1046 | + griddly.griddly("clearSelected"); |
| 1047 | + } |
| 1048 | + |
| 1049 | + return result; |
1031 | 1050 | }
|
1032 | 1051 |
|
1033 | 1052 | throw "onclick must be a global function";
|
|
1096 | 1115 | .appendTo("body").submit().remove();
|
1097 | 1116 | };
|
1098 | 1117 |
|
1099 |
| - GriddlyButton.ajax = function (url, selection, button, griddly) |
| 1118 | + GriddlyButton.ajax = function (url, selection, button, griddly, clearSelection) |
1100 | 1119 | {
|
1101 | 1120 | for (var i = 0; i < selection[Object.keys(selection)[0]].length; i++)
|
1102 | 1121 | {
|
|
0 commit comments