how to use renderBodyTemplate to filter state data?

UI Components for React
Post Reply
july
Posts: 2
Joined: 12 Sep 2020, 10:07

14 Sep 2020, 06:09

Hi ,

I am new to reactjs and primerecat too . I used datatable and column with renderBodyTemplate where I am filtering this.state.data but it is error with undefiend please suggest a good way to use this.state.data in renderBodyTemplate.



constructor(props) {
super(props);

this.state = {
roles:[],

roleByRoleIdTemplate(rowData){
let role = this.state.roles.filter(val => !rowData.roleId===val.id);
return <span>{role.name}</span>

}

<Column field="roleId" header="Role" body={this.roleByRoleIdTemplate}></Column>

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

10 Oct 2020, 21:17

Hi,

I think this link can help to you;
https://www.primefaces.org/primereact/s ... /datatable (please try 'edit in Codesandbox' button under source tab)

Please inform us again if you have any problems.
Best Regards,

njain
Posts: 6
Joined: 01 Nov 2016, 09:05

26 Nov 2020, 17:43

Hello,

I have a similar issue to resolve. Were you able to figure out a solution?

My Post
viewtopic.php?f=57&t=64243&p=186685#p186685

Best Regards
Nitin

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests