fix: reorder items in same column and save the order
This commit is contained in:
parent
c7e3e1d486
commit
fda377f6d2
@ -315,6 +315,9 @@ def get_data(
|
||||
if hasattr(_list, "default_kanban_data"):
|
||||
rows = _list.default_kanban_data().get("rows")
|
||||
|
||||
if "name" not in rows:
|
||||
rows.append("name")
|
||||
|
||||
for column in columns:
|
||||
column_filters = { column_field: column.get('name') }
|
||||
if column_field in filters and filters.get(column_field) != column.name:
|
||||
@ -328,6 +331,10 @@ def get_data(
|
||||
order_by=order_by,
|
||||
page_length=20,
|
||||
)
|
||||
|
||||
if column.get("order"):
|
||||
column_data = sorted(column_data, key=lambda x: column.get("order").index(x.get("name")))
|
||||
|
||||
data.append({"column": column, "data": column_data, "count": len(column_data)})
|
||||
|
||||
fields = frappe.get_meta(doctype).fields
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
group="fields"
|
||||
item-key="name"
|
||||
class="flex flex-col gap-3.5 overflow-y-auto h-full"
|
||||
@end="updateColumn"
|
||||
>
|
||||
<template #item="{ element: fields }">
|
||||
<div
|
||||
@ -129,6 +130,7 @@ function updateColumn() {
|
||||
let _columns = []
|
||||
columns.value.forEach((col) => {
|
||||
if (col.delete) return
|
||||
col.column['order'] = col.data.map((d) => d.name)
|
||||
_columns.push(col.column)
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user