interface ProjectExplorerState {
columns: Array<DataColumn<ProjectExplorerItem>>;
+ searchValue: string;
+ page: number;
+ rowsPerPage: number;
}
class ProjectExplorer extends React.Component<ProjectExplorerProps, ProjectExplorerState> {
state: ProjectExplorerState = {
+ searchValue: "",
+ page: 0,
+ rowsPerPage: 10,
columns: [{
name: "Name",
selected: true,
items={this.props.items}
columns={this.state.columns}
contextActions={this.contextMenuActions}
+ searchValue={this.state.searchValue}
+ page={this.state.page}
+ rowsPerPage={this.state.rowsPerPage}
onColumnToggle={this.toggleColumn}
onFiltersChange={this.changeFilters}
onRowClick={console.log}
onSortToggle={this.toggleSort}
- onContextAction={this.executeAction} />;
+ onSearch={this.search}
+ onContextAction={this.executeAction}
+ onChangePage={this.changePage}
+ onChangeRowsPerPage={this.changeRowsPerPage} />;
}
toggleColumn = (toggledColumn: DataColumn<ProjectExplorerItem>) => {
executeAction = (action: ContextMenuAction, item: ProjectExplorerItem) => {
alert(`Executing ${action.name} on ${item.name}`);
}
+
+ search = (searchValue: string) => {
+ this.setState({ searchValue });
+ }
+
+ changePage = (page: number) => {
+ this.setState({ page });
+ }
+
+ changeRowsPerPage = (rowsPerPage: number) => {
+ this.setState({ rowsPerPage });
+ }
}
const renderName = (item: ProjectExplorerItem) =>