npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

table-page-search

v0.15.0

Published

material-ui table with opinionated styling

Downloads

15

Readme

table-page-search

material-ui table with opinionated styling

Install

npm install table-page-search

Example

The following example shows a table with all the functionality: Running Example

Sample Header Config

Each column of the config should have a "fieldSort" or "display" field in order to show data in the cell.

|Field|Description| | :---: | :--- | |"key"|(Optional) used to highlight the row if selected.| |"itemsPerPage"|(Optional) defaults to 10| |"display"|(Optional if "fieldSort" has value) function to calculate a node for table cell. "onRowClick" will not be fired for cells that use this option but the "onRowClick" is passed as a parameter.| |"fieldSort"|(Optional if "display" has value) sorting and is used for the cell value if "display" is not provided| |"defaultSort"|(Optional) sort field when table is first rendered. if not provided the first column is used.| |"sortDescending"|(Optional) default sort in descending order when table is first rendered when true as a default. if not provided it is false.| |"disableCellClick"|(Optional) disable the cell click. This is helpful for inline editing in the table.|

const headerConfig = {
    key: "id",
    itemsPerPage: 8,
    defaultSort: "lastName",
    sortDescending: true,
    columns: [
        { fieldForSort: "firstName", columnLabel: "Name First", headerCellStyle:{width:80} },
        { fieldForSort: "lastName", columnLabel: "Name Last", disableCellClick: true },
        { fieldForSort: "location.city", columnLabel: "Location" },
        {
            display: (row, columnConfig, onRowClick)=> `${row.lastName}, ${row.firstName}`,
            columnLabel: "Full Name"
        }
    ]
};
//Sample Data
const users = [
    {
        "id": 0,
        "firstName": "Cassandra",
        "lastName": "Andrews",
        "location": { "city" : "Dotseron" }
    },
    {
        "id": 1,
        "firstName": "Lakisha",
        "lastName": "Alvarez",
        "location": { "city" :  "Winfredes" }
    }
];

Sample Component Use

|Field|Description| | :---: | :--- | |"loading"|(Optional) when set to true the table is replaced with a spinner| |"dataList"|data list to display in the table| |"onRowClick"|(Optional) called when user clicks on a row of the table| |"tableStyleName"|(Optional) string name for the class of the table object| |"useMaterialUiPaging"|(Optional) bool use the standard material ui table paging| |"filterText"|(Optional) table only shows values that match substring of value each field concatenated |

  <TablePaging  loading={loading}
                dataList={users}
                headerConfig={headerConfig}
                filterText={filterText}
                useMaterialUiPaging={true}
  />

Server Side Paging

The following options can be used for server side paging. For server side paging, the "dataList" should have the same number of records or less than the "itemsPerPage" of the "headerConfig" object.


"totalRecordsFromServer" = since the dataList only has one page of data, the total number of records is required to render the page buttons and display total record count to the user.

"onServerSidePaging" = This is call any time a sort or page change happens. The fields that are provider are : {sortField, sortDescending, activePage}.

"restPageNumber" = this value is ignored if less than zero and should be a number between 1 and the number of pages. When the value is greater than zero, the page number will be set active for the page buttons