colour one row of antd table based on condition
up vote
0
down vote
favorite
I'm using antd table in my project. I want to change the color of one row of table if IsDefaultAccount = true where IsDefaultAccount is from back end
The code of the table in the index.js page is :
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName='data-row'
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
reactjs redux antd
add a comment |
up vote
0
down vote
favorite
I'm using antd table in my project. I want to change the color of one row of table if IsDefaultAccount = true where IsDefaultAccount is from back end
The code of the table in the index.js page is :
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName='data-row'
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
reactjs redux antd
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using antd table in my project. I want to change the color of one row of table if IsDefaultAccount = true where IsDefaultAccount is from back end
The code of the table in the index.js page is :
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName='data-row'
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
reactjs redux antd
I'm using antd table in my project. I want to change the color of one row of table if IsDefaultAccount = true where IsDefaultAccount is from back end
The code of the table in the index.js page is :
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName='data-row'
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
reactjs redux antd
reactjs redux antd
asked Nov 8 at 12:05
Jane Fred
6010
6010
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Assuming that each data-item consists of a IsDefaultAccount
property:
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName={(record) => record.IsDefaultAccount ? 'data-row active-row' : 'data-row' }
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
Let me know if this works.
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows.active-row
should only be applied to the rows of which you wanna change the color. In your case,IsDefaultAccount
. Please do upvote if the code works for you.
– rash.tay
Nov 8 at 12:30
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Assuming that each data-item consists of a IsDefaultAccount
property:
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName={(record) => record.IsDefaultAccount ? 'data-row active-row' : 'data-row' }
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
Let me know if this works.
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows.active-row
should only be applied to the rows of which you wanna change the color. In your case,IsDefaultAccount
. Please do upvote if the code works for you.
– rash.tay
Nov 8 at 12:30
add a comment |
up vote
1
down vote
accepted
Assuming that each data-item consists of a IsDefaultAccount
property:
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName={(record) => record.IsDefaultAccount ? 'data-row active-row' : 'data-row' }
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
Let me know if this works.
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows.active-row
should only be applied to the rows of which you wanna change the color. In your case,IsDefaultAccount
. Please do upvote if the code works for you.
– rash.tay
Nov 8 at 12:30
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Assuming that each data-item consists of a IsDefaultAccount
property:
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName={(record) => record.IsDefaultAccount ? 'data-row active-row' : 'data-row' }
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
Let me know if this works.
Assuming that each data-item consists of a IsDefaultAccount
property:
<Table
className="table-layout"
columns={this.state.columns}
dataSource={filteredData}
rowClassName={(record) => record.IsDefaultAccount ? 'data-row active-row' : 'data-row' }
bordered={true}
size={"small"}
onRowDoubleClick={ (record, index, event) => this.handleEditModal(record) }
onRowClick={(record, index, event) => this.handleRowClick(record)}
loading={this.state.loading}
pagination={{ pageSize: 14 }}
/>
Let me know if this works.
answered Nov 8 at 12:17
rash.tay
1,56531843
1,56531843
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows.active-row
should only be applied to the rows of which you wanna change the color. In your case,IsDefaultAccount
. Please do upvote if the code works for you.
– rash.tay
Nov 8 at 12:30
add a comment |
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows.active-row
should only be applied to the rows of which you wanna change the color. In your case,IsDefaultAccount
. Please do upvote if the code works for you.
– rash.tay
Nov 8 at 12:30
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
The code is working Let me ask you one thing , "data-row active-row" , 'data-row' are these two styles?
– Jane Fred
Nov 8 at 12:27
1
1
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows. active-row
should only be applied to the rows of which you wanna change the color. In your case, IsDefaultAccount
. Please do upvote if the code works for you.– rash.tay
Nov 8 at 12:30
data-row
would have your common row style rules which I am assuming would be the same for active and inactive rows. active-row
should only be applied to the rows of which you wanna change the color. In your case, IsDefaultAccount
. Please do upvote if the code works for you.– rash.tay
Nov 8 at 12:30
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53207404%2fcolour-one-row-of-antd-table-based-on-condition%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown