react-light-table-bootstrap

1.0.6 • Public • Published

react-light-table-bootstrap

This is a tiny package for data table with server pagination

NPM

📦 Installation

npm i react-light-table-bootstrap

Author

Debasis Bhakat

Declaration

Require react-light-table-bootstrap in the top of your file :

import Table from 'react-light-table-bootstrap';

Usage

const TableCol=[
{   
    name:"Video Title",
    id:'title',
    
}, 
{   
    name:"Image",
    id:'thumbnail',
    renderCell: (params) => {
    return (
        <img src={params} height={100} width={100} alt="Card"/>
    );
    }
},
{   
    name:"Date",
    id:'created_at'
},
{   
    name:"Action",
    buttons:[
        {
            name:"Edit",
            mapTo:'id'
        }
    ],
    type:'action',
    renderCell: (params,item) => { 
        return params.map(p=>{
                return (
                    <Link to={`video/edit/${item[p.mapTo]}`}><button>{p.name}</button></Link>
                )
           }) 
    }
}
]; 
const data=[
    {
        title:"demo",
        thumbnail:"image_url"
    }
]
 const pageHandler = async(page) =>{ 
    const controller = new AbortController();
    const { signal } = controller;
    const res = await apicall('your-url','Get', { signal });
    if(res.status===200){
      setData(res.data);
      setCurrentPage(page)
    }
}
<Table column={TableCol} data={data} pageHandler={pageHandler} currentPage={currentPage} pageSize={pageSize} totalResults={totalResults} /> 

/react-light-table-bootstrap/

    Package Sidebar

    Install

    npm i react-light-table-bootstrap

    Weekly Downloads

    7

    Version

    1.0.6

    License

    ISC

    Unpacked Size

    8.72 kB

    Total Files

    6

    Last publish

    Collaborators

    • debasisvortex