3

This is my code I have react table with mock data now What I want now is to select the row data which I have mock columns data that means when I click on any table data it should go to another page and display the data on a page how can I do that I am not getting any clue can anyone help in this

 function ViewAudits(){
      const data = [{  
        audit_name: 'Sha',  
        address: 'road',
        assignee: 'rav',
        start_date: '11/06/2021',
        created_date: "11/06/2021",
        created_by: "sjr",
        contact_person: "ytr",
        phone: "9875636578"

  
     },
    
    ]  
   const columns = [{   
    Header: 'Audit Name',
    accessor: 'audit_name' 
   },{  
    Header: 'Address',
    accessor: 'address'
  },{  
    Header: 'Assignee',
    accessor: 'assignee'
  },{  
    Header: 'Start Date',
    accessor: 'start_date'
  },{  
    Header: 'Created Date',
    accessor: 'created_date'
  },{  
    Header: 'Created By',
    accessor: 'created_by'
  },{  
    Header: 'Contact Person',
    accessor: 'contact_person'
  },{  
    Header: 'Phone',
    accessor: 'phone'

   }]  

  // const getTrprops = (row) => {console.log("log ",row)}
  return (
     <>
    <Navbar/>
     <div className="container md-5 mt-3">
     <ReactTable  
                  data={data}  
          
                  columns={columns}  
                  defaultPageSize = {2}  
            //       getTrProps={(data, column) => {
            //     return {
            //         onClick: (e, t) => { console.log("clickd",e,t) },
                    
            //     }
            // }}

             
  
                  defaultSorted={[
                           {
                      id: "audit_name",
                      desc: true
                              }
                        ]}
                  pageSizeOptions = {[2,4,6]}  
                  
              />   
        </div>
 

I saw few solutions on this didn't work

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.