ambitious-aqua
ambitious-aqua2mo ago

Is it possible to resize column

Is there any way to resize the column of a table ? With any kind of UI? Mantine, Material, Chakra, Ant
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @Yusseiin. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, it is possible to resize the columns of a table in Refine. Refine offers seamless integration with several popular UI libraries, simplifying the use of their table component features such as pagination, sorting, filtering, and more. For example, with the Ant Design Table, Material UI DataGrid, and TanStack Table (for Headless, Chakra UI, Mantine), you can manage your server-side data operations. By using the @refinedev/react-table adapter, you can directly use all the features of React Table in your Refine project. Here is an example of how to display a table with the useTable hook using the TanStack Table:
import React from "react";
import { useTable } from "@refinedev/react-table";
import { ColumnDef, flexRender } from "@tanstack/react-table";

export const ProductTable: React.FC = () => {
const columns = React.useMemo<ColumnDef<IProduct>[]>(
() => [
{
id: "id",
header: "ID",
accessorKey: "id",
meta: {
filterOperator: "eq",
},
},
{
id: "name",
header: "Name",
accessorKey: "name",
meta: {
filterOperator: "contains",
},
},
{
id: "price",
header: "Price",
accessorKey: "price",
meta: {
filterOperator: "eq",
},
},
],
[],
);
const {
getHeaderGroups,
getRowModel,
getState,
setPageIndex,
getCanPreviousPage,
getPageCount,
getCanNextPage,
nextPage,
previousPage,
setPageSize,
} = useTable<IProduct>({
refineCoreProps: {
resource: "products",
},
columns,
});
}
import React from "react";
import { useTable } from "@refinedev/react-table";
import { ColumnDef, flexRender } from "@tanstack/react-table";

export const ProductTable: React.FC = () => {
const columns = React.useMemo<ColumnDef<IProduct>[]>(
() => [
{
id: "id",
header: "ID",
accessorKey: "id",
meta: {
filterOperator: "eq",
},
},
{
id: "name",
header: "Name",
accessorKey: "name",
meta: {
filterOperator: "contains",
},
},
{
id: "price",
header: "Price",
accessorKey: "price",
meta: {
filterOperator: "eq",
},
},
],
[],
);
const {
getHeaderGroups,
getRowModel,
getState,
setPageIndex,
getCanPreviousPage,
getPageCount,
getCanNextPage,
nextPage,
previousPage,
setPageSize,
} = useTable<IProduct>({
refineCoreProps: {
resource: "products",
},
columns,
});
}
You can find more information and examples in the Refine documentation (https://refine.dev/docs/guides-concepts/general-concepts#tables-). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@115847297299906563> kapa.ai is still learning and improving, please let us know how it did by reacting below