mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Table borders (#7957)
* Add 'editable' attribute to table column type * Add "editable" attribute for useTable hook * Add column borders to tables
This commit is contained in:
parent
ca87df3c3d
commit
1dff94db75
@ -39,6 +39,8 @@ export type TableState = {
|
||||
records: any[];
|
||||
setRecords: (records: any[]) => void;
|
||||
updateRecord: (record: any) => void;
|
||||
editable: boolean;
|
||||
setEditable: (value: boolean) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -131,6 +133,8 @@ export function useTable(tableName: string): TableState {
|
||||
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const [editable, setEditable] = useState<boolean>(false);
|
||||
|
||||
return {
|
||||
tableKey,
|
||||
refreshTable,
|
||||
@ -156,6 +160,8 @@ export function useTable(tableName: string): TableState {
|
||||
setPage,
|
||||
records,
|
||||
setRecords,
|
||||
updateRecord
|
||||
updateRecord,
|
||||
editable,
|
||||
setEditable
|
||||
};
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { ApiFormFieldType } from '../components/forms/fields/ApiFormField';
|
||||
|
||||
export type TableColumnProps<T = any> = {
|
||||
accessor?: string; // The key in the record to access
|
||||
title?: string; // The title of the column - Note: this may be supplied by the API, and is not required, but it can be overridden if required
|
||||
@ -5,6 +7,8 @@ export type TableColumnProps<T = any> = {
|
||||
sortable?: boolean; // Whether the column is sortable
|
||||
switchable?: boolean; // Whether the column is switchable
|
||||
hidden?: boolean; // Whether the column is hidden
|
||||
editable?: boolean; // Whether the value of this column can be edited
|
||||
definition?: ApiFormFieldType; // Optional field definition for the column
|
||||
render?: (record: T, index?: number) => any; // A custom render function
|
||||
filter?: any; // A custom filter function
|
||||
filtering?: boolean; // Whether the column is filterable
|
||||
|
@ -697,6 +697,7 @@ export function InvenTreeTable<T = any>({
|
||||
|
||||
<DataTable
|
||||
withTableBorder
|
||||
withColumnBorders
|
||||
striped
|
||||
highlightOnHover
|
||||
loaderType="dots"
|
||||
|
Loading…
Reference in New Issue
Block a user