Skip to content

Instantly share code, notes, and snippets.

View aleger's full-sized avatar

Andrew Leger aleger

View GitHub Profile
@aleger
aleger / jqueryDatatablesExpandRow.js
Created April 9, 2018 13:10
jqueryDatatablesExpandRow
"use strict";
var DataTables = (function(pub) {
//Private variables
//Public functions
pub.Entity = function () {
//Destroy table if exists
@aleger
aleger / Select2_AutocompleteHelper.js
Last active April 4, 2018 13:24
Javascript helper to initialize Select2 elements and autocomplete
//select2
destroySelect2: function(element) {
$(element).empty();
$(element).select2('destroy');
},
initializeSelect2: function (element, options) {
var defaultOptions = {
placeholder: 'Select',
allowClear: true
@aleger
aleger / resizeScrollBox.js
Created June 7, 2017 20:07
Resizes the scrollbox on initialization for Chrome or Internet Explorer (jQuery)
//Resizes the Org Chart window for Chrome or Internet Explorer
function resizeOrgChartWindow() {
//For Chrome
if (window.orgChartWindow.contentDocument) {
//Now that the orgchart is in an iFrame, scrollHeight was chaged to offsetHeight. -Andrew
window.orgChartWindow.style.height = window.orgChartWindow.contentDocument.body.offsetHeight + 30 + 'px';
}
//For Internet Explorer
else if (window.orgChartWindow.document) {
$("#orgChartWindow").css("height", window.orgChartWindow.document.body.offsetHeight + 30 + 'px');
@aleger
aleger / horizontalScrolling.js
Last active June 7, 2017 20:08
Custom horizontal scrolling (jQuery)
//Horizontal Scrolling for the Org Chart
function horzontalScrolling() {
$(".scroll-btn-left").hide();
if ($.browser.chrome) {
var orgChartTarget = "body"
} else {
var orgChartTarget = "html"
}