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

react-backend-table

v0.1.16

Published

React Backend Bootstrap data table

Downloads

45

Readme

React Backend Data Table

React Backend data table project build with react type script. All search filter sorting are call backend , data filter show from backend , global search columnsearch and sort are configureable . Its call a http post request after change frontend for new data retrive

Prerequisite

This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, use react-bootstrap version "^2.1.1" and react-icons version "^4.3.1" try running the following command.

$ npm -v && node -v

Getting Started

These instructions will help to install and usethis library

Installation

$ npm install react-backend-table

Usage

Import React Backend Table

import BackendTable from "react-backend-table";
import {LooseObject} from  "react-backend-table";

Initialize Props Like an example

 let columns = [
    { title: "id", field: "id_users" ,sortable:true, searchable:true , thStyle:{width:100} },
    { title: "name", field: "username", sortable:true,  searchable:true },
    { title: "email", field: "email", sortable:true,  searchable:true },
    { title: "create date", field: "create_date", sortable:false },
    { 
      title: "Action",
      field: "action",
      sortable:false,
      searchable:false,
      hasComponent:true,
      componentValue:( (rowValue:LooseObject )=>{  return (<Button size={'sm'} onClick={()=>{ test( rowValue.name.toString() ); }}>Delete</Button>) })
    }
  ]
  let options = {
    title:"Hello Table",
    url:"Your Backend URL" ,//http://192.168.0.6/login_v2/Login/reactDataTable
    perPage:[10,20,50,100],
    orderBy:"id_users",
    orderType: "asc",
    columnSearch: true 
  }

Finally load your componnent

   <BackendTable columns={columns} options={options} />

Full Example Bellow

import BackendTable from "react-backend-table";
import {LooseObject} from  "react-backend-table";
import { Button } from "react-bootstrap";

function App() {
  let columns = [
    { title: "id", field: "id_users" ,sortable:true, searchable:true , thStyle:{width:100} },
    { title: "name", field: "username", sortable:true,  searchable:true },
    { title: "email", field: "email", sortable:true,  searchable:true },
    { title: "create date", field: "create_date", sortable:false },
    { 
      title: "Action",
      field: "action",
      sortable:false,
      searchable:false,
      hasComponent:true,
      componentValue:( (rowValue:LooseObject )=>{  return (<Button size={'sm'} onClick={()=>{ test( rowValue.name.toString() ); }}>Delete</Button>) })
    }
  ]
  let options = {
    title:"Hello Table",
    url:"http://192.168.0.6/login_v2/Login/reactDataTable",
    perPage:[10,20,50,100],
    orderBy:"id_users",
    orderType: "asc",
    columnSearch: true 
  }

  return (
   <BackendTable columns={columns} options={options} />
  );
}

BACKEND API

All Data from Data Table will get as post data . this is a dummy backend code for use , Follow response value for work properly , "SQL_CALC_FOUND_ROWS" sql cluse use for get total easy way dont worry for that just find out total your won way

    $filter = $this->input->post();		
		$this->db->select('SQL_CALC_FOUND_ROWS users.id_users AS `id_users`', FALSE);
		$this->db->select('username');
		$this->db->select('email');
		$this->db->select('create_date');
		$this->db->from('users');

		if($filter["globalSearch"]!= ""){
			$this->db->like("username",$filter["globalSearch"]);
		}
		if (!empty($filter["limit"])) {
			$this->db->limit($filter["limit"], $filter["offset"]);
		} else {
			$this->db->limit(10, 0);
		}
		$query  = $this->db->get();
		$result = $query->result_array();
		$total = $this->db->query("SELECT FOUND_ROWS() AS `total`")->row()->total;
		echo json_encode(array('data' =>array("data"=>$result, "total"=> $total) ,"status"=>true));

Credits

Destraza Soft

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • **Ashaduz zaman **
  • **Adnan Nuruddin **

License

destraza Software