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 () {
if (!$.fn.dataTableExt) {
return;
@ -226,8 +226,8 @@
})();
/************************************************************************
* AJAX extension for datatables *
*************************************************************************/
* AJAX extension for datatables *
*************************************************************************/
(function () {
datatables.createAjax = function (serverMethod, inputAction) {
return function (requestData, callback, settings) {
@ -275,8 +275,8 @@
})();
/************************************************************************
* Configuration/Options normalizer for datatables *
*************************************************************************/
* Configuration/Options normalizer for datatables *
*************************************************************************/
(function () {
var customizeRowActionColumn = function (column) {
@ -291,7 +291,7 @@
datatables.normalizeConfiguration = function (configuration) {
configuration.scrollX = true;
configuration.scrollX = datatables.defaultConfigurations.scrollX;
for (var i = 0; i < configuration.columnDefs.length; i++) {
var column = configuration.columnDefs[i];
@ -304,34 +304,22 @@
}
}
configuration.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.language = datatables.defaultConfigurations.language;
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;
};
})();
/************************************************************************
* Default Renderers *
*************************************************************************/
* Default Renderers *
*************************************************************************/
datatables.defaultRenderers = datatables.defaultRenderers || {};
datatables.defaultRenderers['boolean'] = function(value) {
@ -356,4 +344,31 @@
.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