React-bs-simple-datatable

react-bs-simple-datatable

제품 정보

즐겨찾기

오픈소스 사용 사례

공개 채팅

지원 계획

현재 사용할 수 있는 OSS 플랜이 없습니다.

저장소의 제공자 또는 기여자인 경우 OSS 플랜 추가를 시작할 수 있습니다.

OSS 플랜 추가
여기에서 자세히 알아보세요

이 오픈소스에 대한 플랜을 찾고 있다면 저희에게 문의해 주세요.

전문 공급자와 연락하실 수 있도록 도와드리겠습니다.

제품 세부 정보

a react data-table component built on react and bootstrap

React-bs-simple-datatable

A react component data-table librabry. Latest version - v1.0.3

data-table

Table of Contents

How to Use

<DataTable
    headers={headers}
    body={bodyAsJSONArray}
    isPaging
    pageSize={3}
    noOfIndexToBeShown={3}  
    enableDelete
    enableEdit    
    onRowUpdate={methodToHandleEditingRecord}
    enableFilter
  />

Datatable Header Configuration

  • Specify header type as IHeaderType[].
  • title is what to show in data table header
  • prop is property name of data source
  • enableSort to enabe sorting to specific column
  • noEdit to restrict editing the specific column
  • type is data type of property
  • optionsOnEdit provides multiple option while on edit mode (provide only when the field is a dropdown)

Following code is a header sample. Pass this headers object to headers props of DataTable component

var headers: IHeaderType[] = [
  { title: "Id", prop: "id", enableSort: true, noEdit: true },
  { title: "Name", prop: "name", enableSort: true },
  { title: "Address", prop: "add" },
  { title: "Age", prop: "age", enableSort: true},
  { title: "Country", prop: "country", enableSort: true,  type: PropDataType.MULTI_OPTION, optionsOnEdit: sampleOptions},
  { title: "Status", prop: "status", type: PropDataType.CHECKBOX }
];

var sampleOptions = [ "USA", "IND", "AUS"];

Header Types

Header type as follows

interface IHeaderType {
    title: string;
    prop: string;
    enableSort?: boolean;
    type?: PropDataType;
    optionsOnEdit?: any;
    noEdit?: boolean;
}

Property types as follows

enum PropDataType {
    TEXT, MULTI_OPTION, CHECKBOX
}

Sorting

enableSort: true in header configuration to enable sorting

Paging

  • Provide isPaging to enable pagination
  • Provide pageSize={noOfRecordsPerPage} to show specific number of records per page
  • Provide noOfIndexToBeShown={3} to show number of page indexes in paging div

<DataTable isPaging pageSize={3} noOfIndexToBeShown={3} />

paging snapshot

Filter

Provide eneableFilter props to enable filter operation in datatable NOTE: By default filter is wild card search from every column

<DataTable enableFilter />

fliter snapshot

Edit

Provide enableEdit props to enable edit button in data table <DataTable enableEdit />

edit snapshot edit snapshot on click

Handle Edit Delete Data

Add a event handler to handle modified record. NOTE: DataTable component temporarily updates the record in memory and emits the modifed record for you. Pass your method to handle that object as shown below. This will work in both update and delete operation

<DataTable
    onRowUpdate={methodToHandleEditingRecord}
  />

function methodToHandleEditingRecord(record) {
    // record object holds the selected edited record from data source
    // update to database
}

문의하기

  • 비즈니스 개발자를 위한 최신 정보를 원하십니까? 소스 코드 프로젝트에 대한 PieceX 커뮤니티의 요구사항을 알아보세요. PieceX의 최신 무료 커뮤니티 코드를 빠르게 알려드립니다.
PieceX Logo