|
|
@ -8,6 +8,9 @@ define([
|
|
|
|
var $body = $t.find('tbody');
|
|
|
|
var $body = $t.find('tbody');
|
|
|
|
var $foot = $t.find('tfoot');
|
|
|
|
var $foot = $t.find('tfoot');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rows = [];
|
|
|
|
|
|
|
|
var cols = [];
|
|
|
|
|
|
|
|
|
|
|
|
var addRow = function (first, Rest, uid) {
|
|
|
|
var addRow = function (first, Rest, uid) {
|
|
|
|
var $row = $('<tr>', {
|
|
|
|
var $row = $('<tr>', {
|
|
|
|
'data-rt-uid': uid,
|
|
|
|
'data-rt-uid': uid,
|
|
|
@ -18,6 +21,8 @@ define([
|
|
|
|
$row.append($('<td>').append(Rest(xy(colId, uid))));
|
|
|
|
$row.append($('<td>').append(Rest(xy(colId, uid))));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rows.push(uid);
|
|
|
|
|
|
|
|
|
|
|
|
$body.append($row);
|
|
|
|
$body.append($row);
|
|
|
|
return $row;
|
|
|
|
return $row;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -33,6 +38,8 @@ define([
|
|
|
|
$(this).append($('<td>').append(Rest(xy(uid, rowId))));
|
|
|
|
$(this).append($('<td>').append(Rest(xy(uid, rowId))));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cols.push(uid);
|
|
|
|
|
|
|
|
|
|
|
|
$foot.find('tr').append($('<td>', { }));
|
|
|
|
$foot.find('tr').append($('<td>', { }));
|
|
|
|
return $width.length;
|
|
|
|
return $width.length;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -43,6 +50,12 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var removeFromArray = function (A, e) {
|
|
|
|
|
|
|
|
var i = A.indexOf(e);
|
|
|
|
|
|
|
|
if (i === -1) { return; }
|
|
|
|
|
|
|
|
A.splice(i, 1);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var removeColumn = function (uid) {
|
|
|
|
var removeColumn = function (uid) {
|
|
|
|
//var I/
|
|
|
|
//var I/
|
|
|
|
var $col = $head.find('th[data-rt-uid="' + uid + '"]');
|
|
|
|
var $col = $head.find('th[data-rt-uid="' + uid + '"]');
|
|
|
@ -61,6 +74,8 @@ define([
|
|
|
|
// remove it
|
|
|
|
// remove it
|
|
|
|
remove($col);
|
|
|
|
remove($col);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
removeFromArray(cols, uid);
|
|
|
|
|
|
|
|
|
|
|
|
// remove all elements in the body which have the same index
|
|
|
|
// remove all elements in the body which have the same index
|
|
|
|
$body.find('tr').each(function () {
|
|
|
|
$body.find('tr').each(function () {
|
|
|
|
var $this = $(this);
|
|
|
|
var $this = $(this);
|
|
|
@ -74,6 +89,7 @@ define([
|
|
|
|
var $row = $body.find('tr[data-rt-uid="' + uid + '"]');
|
|
|
|
var $row = $body.find('tr[data-rt-uid="' + uid + '"]');
|
|
|
|
if (!$row.length) { return; }
|
|
|
|
if (!$row.length) { return; }
|
|
|
|
remove($row);
|
|
|
|
remove($row);
|
|
|
|
|
|
|
|
removeFromArray(rows, uid);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -82,6 +98,8 @@ define([
|
|
|
|
addColumn: addColumn,
|
|
|
|
addColumn: addColumn,
|
|
|
|
removeRow: removeRow,
|
|
|
|
removeRow: removeRow,
|
|
|
|
removeColumn: removeColumn,
|
|
|
|
removeColumn: removeColumn,
|
|
|
|
|
|
|
|
rows: rows,
|
|
|
|
|
|
|
|
cols: cols,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
return Table;
|
|
|
|
return Table;
|
|
|
|