mergeRight: function()
{
- // fixme - if right is a merged vertical cel.. cant do that.
-
+
// get the contents of the next cell along..
var tr = this.node.closest('tr');
var i = Array.prototype.indexOf.call(tr.childNodes, this.node);
mergeLeft: function()
{
+ // technically this is
+
// get the contents of the next cell along..
var tr = this.node.closest('tr');
var i = Array.prototype.indexOf.call(tr.childNodes, this.node);
}
var table = this.toTableArray();
- if (typeof(table[this.cellData.row][this.cellData.col01]) == 'undefined') {
+ if (typeof(table[this.cellData.row][this.cellData.col-1]) == 'undefined') {
return; // nothing right?
}
var rc = table[this.cellData.row][this.cellData.col01];
if (typeof(table[this.cellData.row+1]) == 'undefined') {
return; // no row below
}
- var rc = table[this.cellData.row+1]
+ if (typeof(table[this.cellData.row+1][this.cellData.col1]) == 'undefined') {
+ return; // nothing right?
+ }
+ var rc = table[this.cellData.row][this.cellData.col];
+ if (rc.colspan != this.cellData.colspan || rc.col != this.cellData.col) {
+ return; // right hand side is not same rowspan.
+ }
+ this.node.innerHTML = this.node.innerHTML + rc.cell.innerHTML ;
+ tr.removeChild(rc.cell);
+ this.rowspan++;
+ this.node.setAttribute('colspan', this.colspan);
+ },
+
+ mergeUp : function()
+ {
+ var table = this.toTableArray();
+ if (typeof(table[this.cellData.row+1]) == 'undefined') {
+ return; // no row below
+ }
+ if (typeof(table[this.cellData.row+1][this.cellData.col1]) == 'undefined') {
+ return; // nothing right?
+ }
+ var rc = table[this.cellData.row][this.cellData.col];
+ if (rc.colspan != this.cellData.colspan || rc.col != this.cellData.col) {
+ return; // right hand side is not same rowspan.
+ }
+ this.node.innerHTML = this.node.innerHTML + rc.cell.innerHTML ;
+ tr.removeChild(rc.cell);
+ this.rowspan++;
+ this.node.setAttribute('colspan', this.colspan);
}