Merge pull request #4234 from abpframework/liangshiwei/datatables

Allow set datatables default configuration
pull/4374/head
Alper Ebicoglu 5 years ago committed by GitHub
commit d73798d522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,8 +8,8 @@
}; };
/************************************************************************ /************************************************************************
* RECORD-ACTIONS extension for datatables * * RECORD-ACTIONS extension for datatables *
*************************************************************************/ *************************************************************************/
(function () { (function () {
if (!$.fn.dataTableExt) { if (!$.fn.dataTableExt) {
return; return;
@ -226,8 +226,8 @@
})(); })();
/************************************************************************ /************************************************************************
* AJAX extension for datatables * * AJAX extension for datatables *
*************************************************************************/ *************************************************************************/
(function () { (function () {
datatables.createAjax = function (serverMethod, inputAction) { datatables.createAjax = function (serverMethod, inputAction) {
return function (requestData, callback, settings) { return function (requestData, callback, settings) {
@ -275,8 +275,8 @@
})(); })();
/************************************************************************ /************************************************************************
* Configuration/Options normalizer for datatables * * Configuration/Options normalizer for datatables *
*************************************************************************/ *************************************************************************/
(function () { (function () {
var customizeRowActionColumn = function (column) { var customizeRowActionColumn = function (column) {
@ -291,7 +291,7 @@
datatables.normalizeConfiguration = function (configuration) { datatables.normalizeConfiguration = function (configuration) {
configuration.scrollX = true; configuration.scrollX = datatables.defaultConfigurations.scrollX;
for (var i = 0; i < configuration.columnDefs.length; i++) { for (var i = 0; i < configuration.columnDefs.length; i++) {
var column = configuration.columnDefs[i]; var column = configuration.columnDefs[i];
@ -304,34 +304,22 @@
} }
} }
configuration.language = { configuration.language = datatables.defaultConfigurations.language;
info: localize("PagerInfo"),
infoFiltered: localize("PagerInfoFiltered"),
infoEmpty: localize("PagerInfoEmpty"),
search: localize("PagerSearch"),
processing: localize("ProcessingWithThreeDot"),
loadingRecords: localize("LoadingWithThreeDot"),
lengthMenu: localize("PagerShowMenuEntries"),
emptyTable: localize("NoDataAvailableInDatatable"),
paginate: {
first: localize("PagerFirst"),
last: localize("PagerLast"),
previous: localize("PagerPrevious"),
next: localize("PagerNext")
}
};
configuration.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto"i><"col"p>>'; if(configuration.dom){
configuration.dom += datatables.defaultConfigurations.dom;
}else{
configuration.dom = datatables.defaultConfigurations.dom;
}
return configuration; return configuration;
}; };
})(); })();
/************************************************************************ /************************************************************************
* Default Renderers * * Default Renderers *
*************************************************************************/ *************************************************************************/
datatables.defaultRenderers = datatables.defaultRenderers || {}; datatables.defaultRenderers = datatables.defaultRenderers || {};
datatables.defaultRenderers['boolean'] = function(value) { datatables.defaultRenderers['boolean'] = function(value) {
@ -356,4 +344,31 @@
.toLocaleString(luxon.DateTime.DATETIME_SHORT); .toLocaleString(luxon.DateTime.DATETIME_SHORT);
}; };
})(jQuery); /************************************************************************
* Default Configurations *
*************************************************************************/
datatables.defaultConfigurations = datatables.defaultConfigurations || {};
datatables.defaultConfigurations.scrollX = true;
datatables.defaultConfigurations.language = {
info: localize("PagerInfo"),
infoFiltered: localize("PagerInfoFiltered"),
infoEmpty: localize("PagerInfoEmpty"),
search: localize("PagerSearch"),
processing: localize("ProcessingWithThreeDot"),
loadingRecords: localize("LoadingWithThreeDot"),
lengthMenu: localize("PagerShowMenuEntries"),
emptyTable: localize("NoDataAvailableInDatatable"),
paginate: {
first: localize("PagerFirst"),
last: localize("PagerLast"),
previous: localize("PagerPrevious"),
next: localize("PagerNext")
}
};
datatables.defaultConfigurations.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto"i><"col"p>>';
})(jQuery);

Loading…
Cancel
Save