Skip to content

Commit

Permalink
Merge pull request #19340 from abpframework/datatables-2
Browse files Browse the repository at this point in the history
Update `datatables.net` to `2.0.2`.
  • Loading branch information
maliming authored May 2, 2024
2 parents 66749c1 + 78d11f2 commit 1abebbe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ public class DatatablesNetScriptContributor : BundleContributor
{
public override void ConfigureBundle(BundleConfigurationContext context)
{
context.Files.AddIfNotContains("/libs/datatables.net/js/jquery.dataTables.js");
if (context.FileProvider.GetFileInfo("/libs/datatables.net/js/dataTables.min.js").Exists)
{
context.Files.AddIfNotContains("/libs/datatables.net/js/dataTables.min.js");
}
else
{
//TODO: Compatible code, Remove it after 8.3 rc1.
context.Files.AddIfNotContains("/libs/datatables.net/js/jquery.dataTables.js");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,17 @@ var abp = abp || {};

if (tableInstance.aoColumns) {
columns = tableInstance.aoColumns;
} else {
} else if (abp.utils.isFunction(tableInstance.fnSettings)) {
columns = tableInstance.fnSettings().aoColumns;
}

if (!columns && abp.utils.isFunction(tableInstance.api)) {
var settings = tableInstance.api().settings();
if (settings.length === 1 && settings[0].aoColumns) {
columns = settings[0].aoColumns;
}
}

if (!columns) {
return;
}
Expand Down Expand Up @@ -271,16 +278,18 @@ var abp = abp || {};
}
};

var _existingApiRenderRowActionsFunction = $.fn.dataTableExt.oApi.renderRowActions;
$.fn.dataTableExt.oApi.renderRowActions =
if ($.fn.dataTableExt.oApi) {
var _existingApiRenderRowActionsFunction = $.fn.dataTableExt.oApi.renderRowActions;
$.fn.dataTableExt.oApi.renderRowActions =
function (tableInstance, nRow, aData, iDisplayIndex, iDisplayIndexFull) {
if (_existingApiRenderRowActionsFunction) {
_existingApiRenderRowActionsFunction(tableInstance, nRow, aData, iDisplayIndex, iDisplayIndexFull);
}

renderRowActions(tableInstance, nRow, aData, iDisplayIndex, iDisplayIndexFull);
};

}

if (!$.fn.dataTable) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion npm/packs/datatables.net-bs5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@abp/datatables.net": "~8.1.1",
"datatables.net-bs5": "^1.11.4"
"datatables.net-bs5": "^2.0.2"
},
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431",
"homepage": "https://abp.io",
Expand Down
3 changes: 2 additions & 1 deletion npm/packs/datatables.net/abp.resourcemapping.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
mappings: {
"@node_modules/datatables.net/js/jquery.dataTables.js": "@libs/datatables.net/js/"
"@node_modules/datatables.net/js/dataTables.min.js": "@libs/datatables.net/js/",
"@node_modules/datatables.net/js/jquery.dataTables.js": "@libs/datatables.net/js/" //TODO: Compatible code, Remove it after 8.3 rc1.
}
}
2 changes: 1 addition & 1 deletion npm/packs/datatables.net/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@abp/jquery": "~8.1.1",
"datatables.net": "^1.11.4"
"datatables.net": "^2.0.2"
},
"gitHead": "bb4ea17d5996f01889134c138d00b6c8f858a431",
"homepage": "https://abp.io",
Expand Down

0 comments on commit 1abebbe

Please sign in to comment.