mirror of
https://github.com/gosticks/react-bootstrap-table2.git
synced 2026-08-12 12:00:16 +00:00
fix #56
* 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:
+4
-4
@@ -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';
|
||||
}
|
||||
}, {
|
||||
|
||||
+2
-2
@@ -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'
|
||||
|
||||
+4
-4
@@ -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';
|
||||
}
|
||||
}, {
|
||||
|
||||
+4
-4
@@ -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'
|
||||
};
|
||||
|
||||
+2
-2
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user