Items hala dolmuyor
This commit is contained in:
parent
9f5c8276da
commit
8c11fedfc9
6 changed files with 45 additions and 6 deletions
|
|
@ -11,6 +11,6 @@ public class ExtraFilterDto
|
||||||
|
|
||||||
public class ExtraFilterItemsDto
|
public class ExtraFilterItemsDto
|
||||||
{
|
{
|
||||||
|
public string Key { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
public string Text { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,45 @@ public class ListFormSelectAppService : PlatformAppService, IListFormSelectAppSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!listForm.ExtraFilterJson.IsNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
var extraFilterList = JsonSerializer.Deserialize<ExtraFilterEditDto[]>(listForm.ExtraFilterJson) ?? [];
|
||||||
|
foreach (var extraFilter in extraFilterList)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(extraFilter.SqlQuery))
|
||||||
|
{
|
||||||
|
var (dynamicDataRepository, connectionString, dataSourceType) = await dynamicDataManager.GetAsync(listForm.IsTenant, listForm.DataSourceCode);
|
||||||
|
|
||||||
|
var items = await dynamicDataRepository.QueryAsync(extraFilter.SqlQuery, connectionString);
|
||||||
|
if (items != null)
|
||||||
|
{
|
||||||
|
var filter = result.GridOptions.ExtraFilterDto.FirstOrDefault(a => a.FieldName == extraFilter.FieldName);
|
||||||
|
|
||||||
|
if (filter != null)
|
||||||
|
{
|
||||||
|
var newItems = new List<ExtraFilterItemsDto>();
|
||||||
|
|
||||||
|
// Yeni gelenleri ekle
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
if (item is IDictionary<string, object> dynamicItem)
|
||||||
|
{
|
||||||
|
newItems.Add(new ExtraFilterItemsDto
|
||||||
|
{
|
||||||
|
Key = dynamicItem.ContainsKey("Key") ? dynamicItem["Key"]?.ToString() : null,
|
||||||
|
Value = dynamicItem.ContainsKey("Value") ? dynamicItem["Value"]?.ToString() : null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listeyi tekrar array olarak ata
|
||||||
|
filter.Items = newItems.ToArray(); // burada direkt filter kullan
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ define(['./workbox-a959eb95'], (function (workbox) { 'use strict';
|
||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "/index.html",
|
"url": "/index.html",
|
||||||
"revision": "0.0c8gpen89r8"
|
"revision": "0.ubgloq1q818"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/index.html"), {
|
||||||
|
|
|
||||||
|
|
@ -735,8 +735,8 @@ export interface ExtraFilterDto {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExtraFilterItemsDto {
|
export interface ExtraFilterItemsDto {
|
||||||
|
key: string
|
||||||
value: string
|
value: string
|
||||||
text: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExtraFilterEditDto extends ExtraFilterDto {
|
export interface ExtraFilterEditDto extends ExtraFilterDto {
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ function JsonRowOpDialogExtraFilter({
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
label="Sql Query"
|
label="Sql Query (Key, Value)"
|
||||||
invalid={errors.sqlQuery && touched.sqlQuery}
|
invalid={errors.sqlQuery && touched.sqlQuery}
|
||||||
errorMessage={errors.sqlQuery}
|
errorMessage={errors.sqlQuery}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,8 @@ export function GridExtraFilterToolbar({
|
||||||
>
|
>
|
||||||
<option value="">Seçiniz</option>
|
<option value="">Seçiniz</option>
|
||||||
{fs.items.map((item: any) => (
|
{fs.items.map((item: any) => (
|
||||||
<option key={item.value} value={item.value}>
|
<option key={item.key} value={item.key}>
|
||||||
{item.text}
|
{item.value}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue