|
|
@@ -80,7 +80,7 @@ class TableModel extends React.Component {
|
|
|
timing(obj) {
|
|
|
let key = setInterval(function () {
|
|
|
obj.intervalFunction(this, this.state);
|
|
|
- }.bind(this), obj.intervalTime || 3000);
|
|
|
+ }.bind(this), obj.intervalTime || 5000);
|
|
|
this.timerKeys.push(key);
|
|
|
}
|
|
|
|
|
|
@@ -90,7 +90,7 @@ class TableModel extends React.Component {
|
|
|
let node = this.refs.body;
|
|
|
let title = node.getElementsByClassName('rc-table-title')[0] || { offsetHeight: 0 };
|
|
|
let thead = node.getElementsByClassName('rc-table-thead')[0];
|
|
|
- this.cHeight = node.offsetHeight - title.offsetHeight;
|
|
|
+ this.cHeight = node.offsetHeight - title.offsetHeight - 20;
|
|
|
let trHeight = (this.cHeight) / (this.rowCount);
|
|
|
let trFontSize = pageSize ? `${fontSize/.6 > trHeight ? trHeight * .6 : fontSize}px` : `${trHeight * .6}px`;
|
|
|
// let trFontSize = `${fontSize}px`;
|
|
|
@@ -150,9 +150,11 @@ class TableModel extends React.Component {
|
|
|
var allTitle = document.getElementsByClassName('rc-title')[0] || { offsetHeight: 0 };
|
|
|
let node = this.refs.body;
|
|
|
// 存在title与否会导致计算高度不一致,这里做一个差异补偿
|
|
|
- let nHeight = (node.offsetHeight==window.innerHeight?
|
|
|
- (allTitle.offsetHeight>0?(node.offsetHeight-allTitle.offsetHeight):node.offsetHeight):
|
|
|
- (allTitle.offsetHeight==0?window.innerHeight:node.offsetHeight));
|
|
|
+ // let nHeight = (node.offsetHeight==window.innerHeight?
|
|
|
+ // (allTitle.offsetHeight>0?(node.offsetHeight-allTitle.offsetHeight):node.offsetHeight):
|
|
|
+ // (allTitle.offsetHeight==0?window.innerHeight:node.offsetHeight));
|
|
|
+
|
|
|
+ let nHeight = node.offsetHeight;
|
|
|
let title = node.getElementsByClassName('rc-table-title')[0] || { offsetHeight: 0 };
|
|
|
let thead = node.getElementsByClassName('rc-table-thead')[0];
|
|
|
this.cHeight = nHeight - title.offsetHeight;
|
|
|
@@ -252,28 +254,37 @@ class TableModel extends React.Component {
|
|
|
let { themeConfig } = this.newProps;
|
|
|
themeConfig = themeConfig || {
|
|
|
head: {},
|
|
|
+ stripeRows: [],
|
|
|
cells: {}
|
|
|
};
|
|
|
- let { head, cells } = themeConfig;
|
|
|
+ let { head, stripeRows, cells } = themeConfig;
|
|
|
let node = this.refs.body;
|
|
|
let table = node.getElementsByClassName('rc-table')[0];
|
|
|
|
|
|
let thCells = table.getElementsByTagName('th');
|
|
|
- let tdCells = table.getElementsByTagName('td');
|
|
|
|
|
|
for(let j = 0; j < thCells.length; j++) {
|
|
|
let cell = thCells[j];
|
|
|
for(let k in head) {
|
|
|
cell.style[k] = head[k];
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ let tbody = table.getElementsByTagName('tbody')[0];
|
|
|
+ let rows = tbody.getElementsByTagName('tr');
|
|
|
|
|
|
- for(let i = 0; i < tdCells.length; i++) {
|
|
|
- let cell = tdCells[i];
|
|
|
- for(let k in cells) {
|
|
|
- cell.style[k] = cells[k];
|
|
|
+ for(let j = 0; j < rows.length; j++) {
|
|
|
+ let tdCells = rows[j].getElementsByTagName('td');
|
|
|
+ for(let i = 0; i < tdCells.length; i++) {
|
|
|
+ let cell = tdCells[i];
|
|
|
+ for(let k in cells) {
|
|
|
+ cell.style[k] = cells[k];
|
|
|
+ }
|
|
|
+ if(stripeRows.length > 0) {
|
|
|
+ cell.style.backgroundColor = stripeRows[j%2];
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
render() {
|