bsr-table-extension
v2.1.5
Published
React component table
Downloads
4
Maintainers
Readme
bsr-table-extension
React component table
Install
npm install --save bsr-table-extension
Usage
import React from 'react';
import {Column, Table, DataRow} from "./table";
import './index.css'
type User = {
id: string,
name: string,
age: string
profession: string
}
const users: Array<User> = []
for (let i = 0; i < 10; i++) {
users.push({
age: `V:${i}`,
name: `name:${i}`,
id: `${i}`,
profession: "programmer"
})
}
function getItem() {
const list: DataRow<User,User>[]= [];
users.forEach(user => {
list.push({
tag:user,
getView: () => {
return user
}
})
})
return list
}
export default function App() {
return (
<Table rowItems={getItem()}>
<Column style={{width:50}} propertyName={'id'}>id</Column>
<Column propertyName={'name'}>Name</Column>
<Column propertyName={'age'}>Age</Column>
<Column propertyName={'profession'}>Profession</Column>
</Table>
)
}
License
MIT © ionson100