Material-table: User experience of adding new record

Created on 5 Jun 2019  路  3Comments  路  Source: mbrn/material-table

Is your feature request related to a problem? Please describe.
In editable mode, if you have 6 records in a table and your page size is 5 and then you decide to add new row, your new record is added at the end of the table. And, you cannot understand that if record is added or not.

Describe the solution you'd like
After adding new record, table should navigate to page where the record is located.

Describe alternatives you've considered
Maybe, setPage method could be added. And developer could set page manually.

Additional context
I added screenshots to make it clear.

This table has 6 records.
image

When adding a new record.
image

After adding process completed, you can't understand where the new record is
image

The new record is at the end. This user experience needs to be developed.
image

help wanted

All 3 comments

Did you try adding addRowPosition in options props like so ?
options: { addRowPosition: 'first' }

Yeah, I tried it. When I save the record in database. It goes at the end of table, too. Maybe, I can order data when I retrieve from database but I feel that this solutions are a bit complicated and I didn't like it.

I did another workaround for this problem.
I looked to the source code and I solved my problem in a different way :)
I do not recommend this solution to anyone :)

 <MaterialTable
        tableRef={table}
        title="Book Categories
        .
        .
        onRowAdd: newData =>
            new Promise(resolve => {
              setTimeout(() => {
                table.current.dataManager.changeCurrentPage(newPage);
              }, 600);
            }),
            />

Finally, I used options: { addRowPosition: 'first' } and retrieved data from db in reverse order.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

victorwvieira picture victorwvieira  路  3Comments

Mihier-Roy picture Mihier-Roy  路  3Comments

slevy85 picture slevy85  路  3Comments

jlgreene2 picture jlgreene2  路  3Comments

VipinJoshi picture VipinJoshi  路  3Comments