fix filtering and sorting
This commit is contained in:
parent
ba507f8e6a
commit
3b86ed0ee7
7 changed files with 334 additions and 201 deletions
|
|
@ -1696,8 +1696,21 @@ class DataUtils {
|
|||
];
|
||||
|
||||
static toSnakeCaseObject(obj) {
|
||||
console.log("Converting to snake case:", obj);
|
||||
const newObj = Object.entries(obj).reduce((acc, [key, value]) => {
|
||||
const snakeKey = key.replace(/[A-Z]/g, (match) => "_" + match.toLowerCase());
|
||||
if (key === "sorting") {
|
||||
value = value
|
||||
? value.map((item) => {
|
||||
const [field, order] = item;
|
||||
const snakeField = field.replace(
|
||||
/[A-Z]/g,
|
||||
(match) => "_" + match.toLowerCase(),
|
||||
);
|
||||
return [snakeField, order];
|
||||
})
|
||||
: value;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value = value.map((item) => {
|
||||
return Object.prototype.toString.call(item) === "[object Object]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue