Reactjs 如何更改反应材质表中自由动作图标的位置

Reactjs 如何更改反应材质表中自由动作图标的位置,reactjs,material-ui,material-table,Reactjs,Material Ui,Material Table,我想在左上角放置一个freeAction按钮。 这是我想要的说明 我知道这有点像。但是无法做到这一点,也找不到任何例子。谢谢大家的关注。这很容易,但以前没有找到。 我在材质表标记中添加了一个选项 options={{ search: true, actionsColumnIndex: -1, toolbarButtonAlignment:"left" // here is the option to change toolbar buttons'

我想在左上角放置一个freeAction按钮。 这是我想要的说明


我知道这有点像。但是无法做到这一点,也找不到任何例子。

谢谢大家的关注。这很容易,但以前没有找到。 我在材质表标记中添加了一个选项

  options={{
    search: true,
    actionsColumnIndex: -1,
    toolbarButtonAlignment:"left" // here is the option to change toolbar buttons' alignment
  }}

谢谢大家的关注。这很容易,但以前没有找到。 我在材质表标记中添加了一个选项

  options={{
    search: true,
    actionsColumnIndex: -1,
    toolbarButtonAlignment:"left" // here is the option to change toolbar buttons' alignment
  }}

您可以通过覆盖工具栏组件而不是使用
操作
属性来实现这一点。下面是
上所需的
组件
属性的示例代码,您可以根据需要更改样式和组件:

components={{
    Toolbar: (toolbarProps) => (
      <Box display="flex" alignItems="center">
        <Button
          style={{ marginLeft: '8px', marginRight: 'auto' }}
          variant="contained"
          color="secondary"
        >
          Refresh
        </Button>
        <MTableToolbar {...toolbarProps} />
      </Box>
    ),
  }}
组件={{
工具栏:(工具栏道具)=>(
刷新
),
}}

您可以通过覆盖工具栏组件而不是使用
操作
属性来实现这一点。下面是
上所需的
组件
属性的示例代码,您可以根据需要更改样式和组件:

components={{
    Toolbar: (toolbarProps) => (
      <Box display="flex" alignItems="center">
        <Button
          style={{ marginLeft: '8px', marginRight: 'auto' }}
          variant="contained"
          color="secondary"
        >
          Refresh
        </Button>
        <MTableToolbar {...toolbarProps} />
      </Box>
    ),
  }}
组件={{
工具栏:(工具栏道具)=>(
刷新
),
}}

我不确定实际的freeAtcion按钮,但您可以通过工具栏覆盖示例实现非常相似的位置,它位于您共享的链接中,它不会与搜索组件处于同一级别,但至少通过覆盖工具栏组件,您可以更自由地定位刷新按钮我不确定实际的freeAtcion按钮,但您可以实现与工具栏覆盖示例非常相似的位置,它位于您共享的链接中,与搜索组件不在同一级别,但至少,通过覆盖工具栏组件,您可以更自由地定位“刷新”按钮