layer5io / sistent

Layer5 Design System
https://layer5.io/projects/sistent
Apache License 2.0
69 stars 95 forks source link

`ResponsiveDataTable` bug and readme updates #635

Open dottharun opened 5 months ago

dottharun commented 5 months ago

Current Behavior

function App() { const columns = [ { name: "name", label: "Name" }, { name: "company", label: "Company" }, { name: "city", label: "City" }, { name: "state", label: "State" }, ];

const data = [ ["Joe James", "Test Corp", "Yonkers", "NY"], ["John Walsh", "Test Corp", "Hartford", "CT"], ["Bob Herm", "Test Corp", "Tampa", "FL"], ["James Houston", "Test Corp", "Dallas", "TX"], ];

const colVis = { name: true, company: false, city: true, state: true };

return ( <> <ResponsiveDataTable data={data} columns={columns} columnVisibility={colVis} /> </> ); }

export default App;

![image](https://github.com/layer5io/sistent/assets/80959679/7cac54da-e3fe-4c52-8d5a-f4376848c986)
- From the [implementation](https://github.com/layer5io/sistent/blob/44eb9698d484b4904e0ecc0e0056103cd8bcf0a3/src/custom/ResponsiveDataTable.tsx#L29) `tableCols` prop seems to be required to render the Table.
- Even with `tableCols` prop, `columnVisibility` seems to be ignored.
```tsx
import { ResponsiveDataTable } from "@layer5/sistent";

function App() {
  const columns = [
    { name: "name", label: "Name" },
    { name: "company", label: "Company" },
    { name: "city", label: "City" },
    { name: "state", label: "State" },
  ];

  const data = [
    ["Joe James", "Test Corp", "Yonkers", "NY"],
    ["John Walsh", "Test Corp", "Hartford", "CT"],
    ["Bob Herm", "Test Corp", "Tampa", "FL"],
    ["James Houston", "Test Corp", "Dallas", "TX"],
  ];

  const colVis = { name: true, company: false, city: true, state: true };

  return (
    <>
      <ResponsiveDataTable
        data={data}
        tableCols={columns}  //should be optional
        columns={columns}
        columnVisibility={colVis}
      />
    </>
  );
}

export default App;

image

Expected Behavior

Screenshots/Logs

Environment


Contributor Guides and Resources

MrPhenomenal3110 commented 3 months ago

Hii ! I would like to work on this !

kamnajain06 commented 1 month ago

@dottharun Can I work on this if it is not assigned to @MrPhenomenal3110 ?