// create container needed for methods below
var redips = {};
// initialization
redips.init = function () {
// define references and local variables
var rd = REDIPS.drag,
rt = REDIPS.table,
tbl = document.getElementById('table2'), // reference to table2
i; // loop variable
// activate onmousedown event listener on cells within table with id="mainTable"
/* rt.onmousedown('table2', true) */;
// define background color for marked cell
rt.color.cell = '#9BB3DA';
// REDIPS.drag initialization
rd.init();
// set hover color
//rd.hover.colorTd = '#9BB3DA';
// ignore first column in table2 (disable cell click on hidden table)
for (i = 0; i < tbl.rows.length; i++) {
rt.cell_ignore(tbl.rows[i].cells[0]);
}
}
// method merges table cells
redips.merge = function () {
// first merge cells horizontally and leave cells marked
REDIPS.table.merge('h', false);
// and then merge cells vertically and clear cells (second parameter is true by default)
REDIPS.table.merge('v');
// table should be initialized after merging
REDIPS.drag.initTables();
};
// method splits table cells if colspan/rowspan is greater then 1
// mode is 'h' or 'v' (cells should be marked before)
redips.split = function (mode) {
// split marked cells
REDIPS.table.split(mode);
// table should be initialized after merging
REDIPS.drag.initTables();
};
// add onload event listener
if (window.addEventListener) {
window.addEventListener('load', redips.init, false);
}
else if (window.attachEvent) {
window.attachEvent('onload', redips.init);
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.