我们可以将过滤器组件的输入字段替换为材料UI文本字段



我正在尝试用物料图文本字段中的文本字段替换过滤器组件输入字段。我能够通过创建一个新组件来显示输入字段,但没有过滤内容。

我不想要其他过滤功能,只是想用材料UI文本字段替换输入字段

当前的烤架部分是

从'/imports/ui/components/admin/common/common/pagination-new'导入分页;;从'/imports/ui/components/admin/common/common/filtration new';

中导入过滤
    <Griddle
      ref={(ref) => {this._griddle = ref}}
      useGriddleStyles={false}
      columnMetadata={columnMeta}
      results={this.getGriddleData()}
      resultsPerPage={5}
      tableClassName='table'
      showFilter={true}
      settingsText={''}
      showSettings={true}
      settingsToggleClassName={'text-hide'}
      settingsIconComponent={
        <RaisedButton
          label='Columns'
          primary={true}
        />}
      useCustomPagerComponent={true}
      customPagerComponent={Pagination}
      useCustomFilterComponent={true}
      customFilterComponent={Filteration}
      columns={[
        'actions','name', 'published', 'whiteboard.exist',
        'location.floor', 'capacity.number',
        'av.tv','av.appleTv','av.videocon',]}/>

过滤组件

  render() {
    return (
      <div style={{display: 'flex'}}>
          <TextField
            name='title'
            floatingLabelText='title'
          />
      </div>
    )
  },

是的,可以做到。您提供给customFilterComponent的组件将从Griddle接收以下道具:changeFilterresultscurrentResultsplaceholderText。然后,您可以在该组件中引用这些内容,然后将它们传递到材料 - UI Textfield:

render() {
    const { changeFilter, results, currentResults, placeholderText } = this.props;
    return (
        <div style={{ display: 'flex' }}>
            <TextField
                onChange={(e, value) => changeFilter(value)}
                name='title'
                floatingLabelText={placeholderText}
            />
        </div>
    )
}

最新更新