material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Experience issues with customSort

Open LuisPinaSoares opened this issue 6 years ago • 3 comments

I am using version 1.66.0

My table works no problem and native sorting works fine by clicking the headers of all columns. I a trying to add custom sorting just because if you use accented words it helps to use array.localeCompare() as a sort function.

But if i add the following to my column:

    {
      title: 'Nome',
      field: 'mp_nome',
      customSort: (a, b) => a.localeCompare(b),
      render: ({ mp_nome }) => emptyCellFiller(mp_nome),
    },

When i click the column header nothing happens, it disregards onClick event and does no sorting.

Is someone experiencing similar behaviour?

I have pagination activated in my tables

LuisPinaSoares avatar Dec 02 '20 23:12 LuisPinaSoares

Can you provide some example in a sandbox? I just tryed out with some random numbers from 1-100 which is working. Using version 1.67.1 { title: "quantity", field: "quantity", editable: "never", customSort: (rowA, rowB) => rowA.quantity< rowB.quantity, render: (rowData) => {return (

{rowData.quantity}
)}, },

Samurus avatar Dec 03 '20 21:12 Samurus

I'm having the same issue on v1.69.0; The customSort function doesn't get triggered at all.

mvelebit avatar Jan 19 '21 14:01 mvelebit

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Apr 19 '21 22:04 stale[bot]