【问题标题】:Material dataTable材料数据表
【发布时间】:2019-10-24 08:06:56
【问题描述】:

材料表API如何使用,Link to Material Table

例如,我想将搜索placeHolder表单“Search”更改为“Recherche”。

我已经试过了,但它不适合我

<MaterialTable
  title=""
  columns={state.columns}
  data={state.data}
  options={{
    sorting: true,
    searchPlaceholder: "recherche"
  }}
/>

感谢您的帮助

【问题讨论】:

    标签: reactjs material-ui


    【解决方案1】:

    根据npm package(almost last line)

    export interface Localization {
      ...
      toolbar?: {
        ...
        searchPlaceholder?: string;
      };
    }
    

    所以你的代码应该如下所示;

    <MaterialTable
      title=""
      columns={state.columns}
      data={state.data}
      options={{
        sorting: true,
      }}
      localization={{ toolbar: { searchPlaceholder: 'recherche' } }}
    />
    

    【讨论】:

    • 这应该被接受为答案,这是第一个正确答案
    • 是的,你是对的,我的错,谢谢你的帮助:)
    【解决方案2】:

    你试过了吗

    <MaterialTable
      title=""
      columns={state.columns}
      data={state.data}
      options={{
        sorting: true,
        filterPlaceholder: "recherche" // instead of searchPlaceholder
      }}
    />
    

    toolbar.searchPlaceholder

    【讨论】:

      【解决方案3】:
      localization={{ toolbar: { searchPlaceholder: 'Placeholder' } }}
      

      【讨论】:

        猜你喜欢
        • 2019-05-14
        • 1970-01-01
        • 1970-01-01
        • 2020-04-30
        • 2021-01-11
        • 1970-01-01
        • 1970-01-01
        • 2021-03-09
        相关资源
        最近更新 更多