简体   繁体   中英

how to sort material ui datagrid table without affecting total sum rows inside a datagrid

This is my codeSandbox link: https://codesandbox.io/s/making-sum-of-column-in-datagrid-mui-zjzfq6?file=/demo.js

So,when I sort by ascending then subtotal,total and tax rows come up but when sort by descending they comes down.How can I sort by ascending without affecting subtotal, tax and total rows.so that they remain at bottom when someone sort.

I just came across the solution to it.

If you check out the MUI docs on column spanning: https://mui.com/x/react-data-grid/column-spanning/

They've mentioned that you should disable sort for the columns affected by colSpan. You should be able to modify the following from the doc to suit your code requirements:

{ field: 'organization', sortable: false, filterable: false, hideable: false, },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM