publish 1.1.2
This commit is contained in:
parent
64ce46003a
commit
c174915f0d
|
@ -169,6 +169,15 @@ function sum(Table) {
|
||||||
_this.tableType = "array";
|
_this.tableType = "array";
|
||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SumTable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
||||||
|
var columns = this.props.columns;
|
||||||
|
|
||||||
|
if (columns != nextProps.columns) {
|
||||||
|
this.setFooterRender();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//合计数字列,并将计算所得数据存储到一个obj对象中
|
//合计数字列,并将计算所得数据存储到一个obj对象中
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
|
import Button from "bee-button";
|
||||||
import Table from "../../src";
|
import Table from "../../src";
|
||||||
import sum from "../../src/lib/sum.js";
|
import sum from "../../src/lib/sum.js";
|
||||||
|
|
||||||
|
@ -84,29 +85,51 @@ const columns = [
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
const data = [];
|
function getData(){
|
||||||
for (let i = 0; i < 5; i++) {
|
const data = [];
|
||||||
data.push({
|
for (let i = 0; i < 5; i++) {
|
||||||
key: i,
|
data.push({
|
||||||
name: "John Brown",
|
key: i,
|
||||||
age: i + 1,
|
name: "John Brown"+i,
|
||||||
street: "Lake Park",
|
age: i + Math.floor(Math.random()*10),
|
||||||
building: "C",
|
street: "Lake Park",
|
||||||
number: 2035,
|
building: "C",
|
||||||
companyAddress: "Lake Street 42",
|
number: 20 * Math.floor(Math.random()*10),
|
||||||
companyName: "SoftLake Co",
|
companyAddress: "Lake Street 42",
|
||||||
gender: "M"
|
companyName: "SoftLake Co",
|
||||||
});
|
gender: "M"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Demo18 extends Component {
|
class Demo18 extends Component {
|
||||||
|
|
||||||
render() {
|
constructor(props) {
|
||||||
let multiObj = {
|
super(props);
|
||||||
type: "checkbox"
|
this.state = {
|
||||||
|
data: getData()
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
changeData = ()=>{
|
||||||
|
this.setState({
|
||||||
|
data: getData()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const {data} = this.state;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Button
|
||||||
|
className="editable-add-btn"
|
||||||
|
type="ghost"
|
||||||
|
onClick={this.changeData}
|
||||||
|
>
|
||||||
|
动态设置数据源
|
||||||
|
</Button>
|
||||||
|
|
||||||
<ComplexTable
|
<ComplexTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={data}
|
data={data}
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
|
@ -15,6 +15,14 @@ export default function sum(Table) {
|
||||||
//array , tree
|
//array , tree
|
||||||
this.tableType = "array";
|
this.tableType = "array";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps){
|
||||||
|
const {columns} = this.props;
|
||||||
|
if(columns != nextProps.columns){
|
||||||
|
this.setFooterRender();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//合计数字列,并将计算所得数据存储到一个obj对象中
|
//合计数字列,并将计算所得数据存储到一个obj对象中
|
||||||
currentFooter = () => {
|
currentFooter = () => {
|
||||||
let data_2 = this.props.data;
|
let data_2 = this.props.data;
|
||||||
|
|
Loading…
Reference in New Issue