Adding sorting to Accounts
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { useMany } from "@refinedev/core";
|
||||
import {DeleteButton, EditButton, List, useDataGrid} from "@refinedev/mui";
|
||||
import React from "react";
|
||||
|
||||
import { ButtonGroup } from "@mui/material";
|
||||
import { DataGrid, type GridColDef } from "@mui/x-data-grid";
|
||||
|
||||
import { DeleteButton, EditButton, List, useDataGrid} from "@refinedev/mui";
|
||||
|
||||
import type { IAccount } from "../../interfaces";
|
||||
import {AccountCreate} from "./create";
|
||||
import {ButtonGroup} from "@mui/material";
|
||||
|
||||
export const AccountList: React.FC = () => {
|
||||
const { dataGridProps } = useDataGrid<IAccount>();
|
||||
|
||||
@@ -48,8 +48,7 @@ export const dataProvider: DataProvider = {
|
||||
}
|
||||
|
||||
if (sorters && sorters.length > 0) {
|
||||
params.append("sort", sorters.map((sorter) => sorter.field).join(","));
|
||||
params.append("order", sorters.map((sorter) => sorter.order).join(","));
|
||||
params.append("order_by", sorters.map((sorter) => (sorter.order == "asc" ? "+" : "-") + sorter.field).join(","));
|
||||
}
|
||||
|
||||
if (filters && filters.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user