* redefine cell callback function

* it takes 4 argus `content`, `row`, `rowIndex` and `columnIndex` in
* sequence.

* [test] fix unit test for new callback

* correct the version of story for new cell callback

* [DOC] re-define structure of Contents of Table

* [DOC] update document for attrs

* re-write description for each column props

* [DOC] update document for headerCell

* re-write and add extra description for each header column props
This commit is contained in:
ChunMing, Chen
2017-09-16 00:03:07 -05:00
committed by Allen
parent 79fb2523d4
commit ec1a927001
8 changed files with 258 additions and 75 deletions
@@ -14,8 +14,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
align: (cell, row, colIndex) => {
if (row.id % 2 === 0) return 'right';
align: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) return 'right';
return 'left';
}
}, {
@@ -31,8 +31,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
align: (cell, row, colIndex) => {
if (row.id % 2 === 0) return 'right';
align: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) return 'right';
return 'left';
}
}, {
@@ -14,7 +14,7 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
attrs: (cell, row, colIndex) => ({ 'data-test': `customized data ${colIndex}` })
attrs: (cell, row, rowIndex, colIndex) => ({ 'data-test': `customized data ${rowIndex}` })
}, {
dataField: 'price',
text: 'Product Price'
@@ -28,7 +28,7 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
attrs: (cell, row, colIndex) => ({ 'data-test': \`customized data \${colIndex}\` })
attrs: (cell, row, rowIndex, colIndex) => ({ 'data-test': \`customized data \${rowIndex}\` })
}, {
dataField: 'price',
text: 'Product Price'
@@ -14,8 +14,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
classes: (cell, row, colIndex) => {
if (row.id % 2 === 0) return 'demo-row-even';
classes: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) return 'demo-row-even';
return 'demo-row-odd';
}
}, {
@@ -31,8 +31,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
classes: (cell, row, colIndex) => {
if (row.id % 2 === 0) return 'demo-row-even';
classes: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) return 'demo-row-even';
return 'demo-row-odd';
}
}, {
@@ -17,8 +17,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
style: (cell, row, colIndex) => {
if (row.id % 2 === 0) {
style: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) {
return {
backgroundColor: '#81c784'
};
@@ -43,8 +43,8 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
style: (cell, row, colIndex) => {
if (row.id % 2 === 0) {
style: (cell, row, rowIndex, colIndex) => {
if (rowIndex % 2 === 0) {
return {
backgroundColor: '#81c784'
};
@@ -14,7 +14,7 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
title: (cell, row, colIndex) => `this is custom title for ${cell}`
title: (cell, row, rowIndex, colIndex) => `this is custom title for ${cell}`
}, {
dataField: 'price',
text: 'Product Price'
@@ -28,7 +28,7 @@ const columns = [{
}, {
dataField: 'name',
text: 'Product Name',
title: (cell, row, colIndex) => \`this is custom title for \${cell}\`
title: (cell, row, rowIndex, colIndex) => \`this is custom title for \${cell}\`
}, {
dataField: 'price',
text: 'Product Price'