Material-table: Ability to remove add button in every row

Created on 15 Nov 2019  ·  4Comments  ·  Source: mbrn/material-table

Currently have the following table where edit and delete row are implicitly added in editable. Before updating to v1.54.1 there was no add action in every row, only in the right corner. How can I remove on every row?

function Table(props) {
  const { reloadData } = props

  const { token } = useAuth()
  const user = useUser("ME")

  return (
    <MaterialTable
      title="Active Users"
      icons={tableIcons}
      options={{ paging: false }}
      localization={{
        body: { editRow: { deleteText: 'Are you sure you would like to delete this user?' } },
      }}
      columns={[
        {
          title: 'ID',
          field: 'id',
          editable: 'never',
          render: ({ id } = {}) => <>{ellipses(id, 11)}</>,
        },
        { title: 'First name', field: 'first_name' },
        { title: 'Last Name', field: 'last_name' },
        { title: 'Username', field: 'username', editable: 'never' },
        {
          title: 'Password',
          field: 'password',
          searchable: false,
          filtering: false,
          initialEditValue: '',
          render: () => <>&lt;Hidden&gt;</>,
        },
        { title: 'Role', field: 'role', lookup: { ADMIN: 'ADMIN', EDITOR: 'EDITOR' }, editable: (_, row = {}) => row.id !== user.id },
      ]}
      editable={{
        onRowAdd: newData => ...,
        onRowUpdate: (newData, oldData) =>
          updateUser(newData['id'], {
            token,
            changes: shallowObjectComparison(oldData, newData),
          }).then(_ => reloadData()),

        onRowDelete: oldData => ...,
      }}
      {...props}
    />
  )
}

Screen Shot 2019-11-15 at 1 07 11 PM

help wanted

All 4 comments

Hi @jackHedaya ,

I tested this case but i could not reproduce it. Can you check {...props} it may contains additional actions.

Will do when I get home — just realized I wrote “delete” instead of “add.” To clarify, I am referencing the add entry on every row.

Will do when I get home — just realized I wrote “delete” instead of “add.” To clarify, I am referencing the add entry on every row.

I got it :) No problem

Huh really strange –– the error resolved itself. Perhaps I had an incorrect dependency. Thanks anyway!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slevy85 picture slevy85  ·  3Comments

timrchavez picture timrchavez  ·  3Comments

terapepo picture terapepo  ·  3Comments

Likurg2010 picture Likurg2010  ·  3Comments

VipinJoshi picture VipinJoshi  ·  3Comments