From 4fd5d8edd22bc189d297edad6adcf11957b3bdd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96zt=C3=BCrk?= Date: Mon, 17 Nov 2025 21:43:18 +0300 Subject: [PATCH] =?UTF-8?q?onInitNewRow=20d=C3=BCzenlemesi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/list/Grid.tsx | 52 +++++++++++++++++--------------------- ui/src/views/list/Tree.tsx | 52 ++++++++++++++++++-------------------- 2 files changed, 47 insertions(+), 57 deletions(-) diff --git a/ui/src/views/list/Grid.tsx b/ui/src/views/list/Grid.tsx index 10148df2..8c59732b 100644 --- a/ui/src/views/list/Grid.tsx +++ b/ui/src/views/list/Grid.tsx @@ -302,37 +302,31 @@ const Grid = (props: GridProps) => { if (rawFilter) { const parsed = JSON.parse(rawFilter) const filters = extractSearchParamsFields(parsed) + const fieldMatch = filters.find(([field]) => field === colFormat.fieldName) - const hasFilter = filters.some(([field, op, val]) => field === colFormat.fieldName) + if (fieldMatch) { + const val = fieldMatch[2] //value + const dType = colFormat.dataType as DataType - if (hasFilter) { - const fieldMatch = filters.find(([field, op, val]) => field === colFormat.fieldName) - - if (fieldMatch) { - const [, , val] = fieldMatch - - const dType = colFormat.dataType as DataType - - switch (dType) { - case 'date': - case 'datetime': - e.data[colFormat.fieldName] = new Date(val) - break - case 'number': - e.data[colFormat.fieldName] = Number(val) - break - case 'boolean': - e.data[colFormat.fieldName] = val === true || val === 'true' - break - case 'object': - try { - e.data[colFormat.fieldName] = JSON.parse(val) - } catch {} - break - default: - e.data[colFormat.fieldName] = val - break - } + switch (dType) { + case 'date': + case 'datetime': + e.data[colFormat.fieldName] = new Date(val) + break + case 'number': + e.data[colFormat.fieldName] = Number(val) + break + case 'boolean': + e.data[colFormat.fieldName] = val === true || val === 'true' + break + case 'object': + try { + e.data[colFormat.fieldName] = JSON.parse(val) + } catch {} + break + default: + e.data[colFormat.fieldName] = val + break } } } diff --git a/ui/src/views/list/Tree.tsx b/ui/src/views/list/Tree.tsx index 61e66c74..bd7db2ec 100644 --- a/ui/src/views/list/Tree.tsx +++ b/ui/src/views/list/Tree.tsx @@ -62,6 +62,7 @@ import { getList } from '@/services/form.service' import { layoutTypes } from '../admin/listForm/edit/types' import { useListFormCustomDataSource } from './useListFormCustomDataSource' import { useListFormColumns } from './useListFormColumns' +import { DataType } from 'devextreme/common' interface TreeProps { listFormCode: string @@ -313,36 +314,31 @@ const Tree = (props: TreeProps) => { if (rawFilter) { const parsed = JSON.parse(rawFilter) const filters = extractSearchParamsFields(parsed) + const fieldMatch = filters.find(([field]) => field === colFormat.fieldName) - const hasFilter = filters.some(([field, op, val]) => field === colFormat.fieldName) + if (fieldMatch) { + const val = fieldMatch[2] //value + const dType = colFormat.dataType as DataType - if (hasFilter) { - const fieldMatch = filters.find(([field, op, val]) => field === colFormat.fieldName) - - if (fieldMatch) { - const [, , val] = fieldMatch - const dType = colFormat.dataType as any - - switch (dType) { - case 'date': - case 'datetime': - e.data[colFormat.fieldName] = new Date(val) - break - case 'number': - e.data[colFormat.fieldName] = Number(val) - break - case 'boolean': - e.data[colFormat.fieldName] = val === true || val === 'true' - break - case 'object': - try { - e.data[colFormat.fieldName] = JSON.parse(val) - } catch {} - break - default: - e.data[colFormat.fieldName] = val - break - } + switch (dType) { + case 'date': + case 'datetime': + e.data[colFormat.fieldName] = new Date(val) + break + case 'number': + e.data[colFormat.fieldName] = Number(val) + break + case 'boolean': + e.data[colFormat.fieldName] = val === true || val === 'true' + break + case 'object': + try { + e.data[colFormat.fieldName] = JSON.parse(val) + } catch {} + break + default: + e.data[colFormat.fieldName] = val + break } } }