I'm rather new to Javascript, and the scoping syntax definitely confuses me when looking at open source libraries especially when it has a lot of advanced concepts like closure, anonymous functions, etc. The Jquery Datatables RowGroup is a a bit buggy with Responsiveness, so I took the bold attempt of writing my own attempt at a solution.
Below is the relevant snippet from the RowGroup library, source code from https://cdn.datatables.net/rowgroup/1.1.1/js/dataTables.rowGroup.js:
/** <Not sure what is going on here!> */
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery', 'datatables.net'], function ($) {
return factory($, window, document);
});
} else if (typeof exports === 'object') {
// CommonJS
module.exports = function (root, $) {
if (!root) {
root = window;
}
if (!$ || !$.fn.dataTable) {
$ = require('datatables.net')(root, $).$;
}
return factory($, root, root.document);
};
} else {
// Browser
factory(jQuery, window, document);
}
}(function ($, window, document, undefined) {
/** </Not sure what is going on here!> */
'use strict';
var DataTable = $.fn.dataTable;
var RowGroup = function (dt, opts) {
//...
};
$.extend(RowGroup.prototype, {
//...
_constructor: function () {
//...
dt.on('responsive-resize.dt', function () {
that._adjustColspan();
});
},
/** I would like to override this function, externally */
_adjustColspan: function () {
@ @override
}
});
}));
Although it is open source, instead of modifying the library directly, I'd like to override the function _adjustColspan from a separate Javascript file (which will be included after this library). This will allow the library still be update-able without hassle, and any custom changes can be easily tracked.
So I'm looking some clarification on:
Cannot publish new release to Google Play because of Sensitive app permissions
How to store and deal with big chuncks of text between Javascript and HTML
I'm receiving 401 error when trying to override existing POST with new dataIt throws 401
How can I iterate through an ObjectKeys(obj) where the obj might change (and thus need to be a variable that changes)?
I have a form in my webpage and I have created a button in the footer area of my pageI wants if anyone clicks this button then they will go to the contact form which is located on the top of my page