We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { useTranslate, getDefaultFilter, } from "@refinedev/core"; import { CreateButton, EditButton, FilterDropdown, List, useTable, } from "@refinedev/antd"; import { EyeOutlined, SearchOutlined } from "@ant-design/icons"; import { Table, Typography, theme, InputNumber, Input } from "antd"; import InputMask from "react-input-mask"; import type { ICourier } from "../../interfaces"; import { PaginationTotal, CourierStatus, } from "../../components"; import type { PropsWithChildren } from "react";
export const CourierList = ({ children }: PropsWithChildren) => {
const t = useTranslate(); const { token } = theme.useToken();
const { tableProps, filters } = useTable({});
return ( <> <List breadcrumb={false} headerButtons={(props) => [ <CreateButton {...props.createButtonProps} key="create" size="large" > {t("couriers.actions.add")} , ]} > <Table {...tableProps} rowKey="id" scroll={{ x: true }} pagination={{ ...tableProps.pagination, showTotal: (total) => ( ), }} > <Table.Column title={ <Typography.Text style={{ whiteSpace: "nowrap", }} > ID # </Typography.Text> } dataIndex="id" key="id" width={80} render={(value) => ( <Typography.Text style={{ whiteSpace: "nowrap", }} > #{value} </Typography.Text> )} filterIcon={(filtered) => ( <SearchOutlined style={{ color: filtered ? token.colorPrimary : undefined, }} /> )} defaultFilteredValue={getDefaultFilter("id", filters, "eq")} filterDropdown={(props) => ( <FilterDropdown {...props}> <InputNumber addonBefore="#" style={{ width: "100%" }} placeholder={t("products.filter.id.placeholder")} /> )} />
<Table.Column<ICourier> key="name" dataIndex="name" title={t("couriers.fields.name.label")} filterIcon={(filtered) => ( <SearchOutlined style={{ color: filtered ? token.colorPrimary : undefined, }} /> )} defaultFilteredValue={getDefaultFilter("name", filters, "contains")} filterDropdown={(props) => ( <FilterDropdown {...props}> <Input placeholder={t("couriers.filter.name.placeholder")} /> </FilterDropdown> )} /> <Table.Column dataIndex="gsm" key="gsm" title={t("couriers.fields.gsm.label")} filterIcon={(filtered) => ( <SearchOutlined style={{ color: filtered ? token.colorPrimary : undefined, }} /> )} defaultFilteredValue={getDefaultFilter("gsm", filters, "eq")} filterDropdown={(props) => ( <FilterDropdown {...props}> <InputMask mask="(999) 999 99 99"> {/* // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore */} {(props: InputProps) => <Input {...props} />} </InputMask> </FilterDropdown> )} render={(value) => ( <Typography.Text style={{ whiteSpace: "nowrap", }} > {value} </Typography.Text> )} /> <Table.Column<ICourier> dataIndex="status" key="status" title={t("couriers.fields.status.label")} render={(_, record) => { return <CourierStatus value={record.status} />; }} /> <Table.Column title={t("table.actions")} key="actions" fixed="right" align="center" render={(_, record: ICourier) => { return ( <EditButton icon={<EyeOutlined />} hideText recordItemId={record.id} /> ); }} /> </Table> </List> {children} </>
); };
Inside this List from ant-d if i dont give resource it will take resource from routes if i specify resource it does not work
when in the couriers list module i given the resource ="stores" as a list props
it defaultly take routes - resources ,
but alternatively i passed useTable props resource="stores"
it worked !
but any how inside the list component its not supported...
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import {
useTranslate,
getDefaultFilter,
} from "@refinedev/core";
import {
CreateButton,
EditButton,
FilterDropdown,
List,
useTable,
} from "@refinedev/antd";
import { EyeOutlined, SearchOutlined } from "@ant-design/icons";
import { Table, Typography, theme, InputNumber, Input } from "antd";
import InputMask from "react-input-mask";
import type { ICourier } from "../../interfaces";
import {
PaginationTotal,
CourierStatus,
} from "../../components";
import type { PropsWithChildren } from "react";
export const CourierList = ({ children }: PropsWithChildren) => {
const t = useTranslate();
const { token } = theme.useToken();
const { tableProps, filters } = useTable({});
return (
<>
<List
breadcrumb={false}
headerButtons={(props) => [
<CreateButton
{...props.createButtonProps}
key="create"
size="large"
>
{t("couriers.actions.add")}
,
]}
>
<Table
{...tableProps}
rowKey="id"
scroll={{ x: true }}
pagination={{
...tableProps.pagination,
showTotal: (total) => (
),
}}
>
<Table.Column
title={
<Typography.Text
style={{
whiteSpace: "nowrap",
}}
>
ID #
</Typography.Text>
}
dataIndex="id"
key="id"
width={80}
render={(value) => (
<Typography.Text
style={{
whiteSpace: "nowrap",
}}
>
#{value}
</Typography.Text>
)}
filterIcon={(filtered) => (
<SearchOutlined
style={{
color: filtered ? token.colorPrimary : undefined,
}}
/>
)}
defaultFilteredValue={getDefaultFilter("id", filters, "eq")}
filterDropdown={(props) => (
<FilterDropdown {...props}>
<InputNumber
addonBefore="#"
style={{ width: "100%" }}
placeholder={t("products.filter.id.placeholder")}
/>
)}
/>
);
};
Inside this List from ant-d
if i dont give resource it will take resource from routes
if i specify resource it does not work
when in the couriers list module
i given the resource ="stores" as a list props
it defaultly take routes - resources ,
but alternatively i passed useTable props
resource="stores"
it worked !
but any how inside the list component its not supported...
The text was updated successfully, but these errors were encountered: