13

I'm using Material Table and I need change the Action column name but this column is automatic generated because I'm using editable function from material table.

<MaterialTable
    title=""
    localization={{
      body: {
        editRow: {
          saveTooltip: "Salvar",
          cancelTooltip: "Cancelar",
          deleteText: "Tem certeza que deseja deletar este registro?"
        },
        addTooltip: "Adicionar",
        deleteTooltip: "Deletar",
        editTooltip: "Editar"
      }
    }}
    columns={state.columns}
    data={state.data}
    editable={{
      onRowAdd: newData => createInstructor(newData),
      onRowUpdate: async (newData, oldData) =>
        updateInstructor(newData, oldData),
      onRowDelete: oldData => deleteInstructor(oldData)
    }}
  />

How can I change these icons and column name ?

Daniel Obara
  • 267
  • 1
  • 3
  • 13

1 Answers1

18

As you've rightfully assumed, the title of the that column, as well as all the text strings in the material table are customizable via localization property.

<MaterialTable
    // other props
    localization={{
        pagination: {
            labelDisplayedRows: '{from}-{to} of {count}'
        },
        toolbar: {
            nRowsSelected: '{0} row(s) selected'
        },
        header: {
            actions: 'Actions'
        },
        body: {
            emptyDataSourceMessage: 'No records to display',
            filterRow: {
                filterTooltip: 'Filter'
            }
        }
    }}
/>

Notice header.actions item. That's the one for you.

jayarjo
  • 16,124
  • 24
  • 94
  • 138
  • Nice Jayarjo and about change index of column? Because I need put action column at the end of table. And about Icons, can I change Icon of editable functions? https://material-table.com/#/docs/features/editable – Daniel Obara Oct 08 '19 at 12:54
  • Perhaps ask a question about index separately. As of action icons, I've answered to a similar question here: https://stackoverflow.com/questions/58267301/how-to-change-material-table-action-fields-icon/58280858#58280858 – jayarjo Oct 08 '19 at 16:29
  • Also if you find the answer here as solving your problem, don't forget to check it as a correct one. – jayarjo Oct 08 '19 at 16:30
  • I've already seen that question about the icons. I'll ask the question about index separately. Thank you man – Daniel Obara Oct 08 '19 at 17:12
  • can I pass an icon instead of string/text? – Yustina Yasin Dec 22 '21 at 10:14