1.11.0 • Published 6 years ago
react-criteria-table v1.11.0
React Criteria Table
React Criteria Table is a wrapper for React Table (https://react-table.js.org), which is designed to extend base functional.
React Criteria Table is use context (https://reactjs.org/docs/context.html).
Usage
<CriteriaTableController>
<CriteriaTable
cacheKey="tableOne"
onFetchData={(state: Partial<CriteriaTableState>) => /*do requests here*/
onDefaults={(state: CriteriaTableState) => () => ([
{id: "name", show: true },
{id: "surName", show: true },
{id: "birthDate", show: false }
])}
/>
<CriteriaTableSettings activeTableKey="tableOne"/>
</CriteriaTableController>cacheKeyis identifier of table. Is also used to save data to local storageactiveTableKeyis define, which of table settings must be displayedonFetchDatais callback, of React TableonFetchData(https://react-table.js.org/#/story/readme)onDefaultsis callback, that called onComponentWillMountand initialize saved data and default data
Interfaces
ConditionType : "=" | "<>" | ">" | "<" | "!=" | ">=" | "<=" | "like" | "in"
Condition: ConditionType, string, string | number | boolean
CriteriaTableState:
- cancelToken?:
CancelTokenSource(https://github.com/axios/axios#cancellation) - queries?:
Array<Condition> - data: {
- list:
Array<any> - count:
number - total:
any}
- list:
- sorted?: Array<{ id:
string, desc:boolean}> - pageSize?:
number - pages?:
number - page?:
number