hotfix: pagination

This commit is contained in:
Julian Krauser 2024-12-30 10:54:52 +01:00
parent 0e430d1c9d
commit e9fce9baec

View file

@ -20,10 +20,10 @@
<slot <slot
v-else v-else
name="pageRow" name="pageRow"
v-for="(item, index) in items" v-for="(item, index) in visibleRows"
:key="index" :key="index"
:row="item" :row="item"
@click="$emit('clickRow', item.id)" @click="$emit('clickRow', item)"
> >
<p>{{ item }}</p> <p>{{ item }}</p>
</slot> </slot>
@ -106,7 +106,7 @@ const emit = defineEmits({
search(search: string) { search(search: string) {
return typeof search == "number"; return typeof search == "number";
}, },
clickRow(id: FieldType) { clickRow(elem: T) {
return true; return true;
}, },
}); });
@ -163,7 +163,11 @@ const filterData = (array: Array<any>, searchString: string, start: number, end:
(elem) => (elem) =>
!props.enablePreSearch || !props.enablePreSearch ||
searchString.trim() == "" || searchString.trim() == "" ||
props.config.some((col) => typeof elem?.[col.key] == "string" && elem[col.key].includes(searchString.trim())) props.config.some(
(col) =>
typeof elem?.[col.key] == "string" &&
elem[col.key].toLowerCase().includes(searchString.trim().toLowerCase())
)
) )
.filter((elem, index) => (elem?.tab_pos ?? index) >= start && (elem?.tab_pos ?? index) < end); .filter((elem, index) => (elem?.tab_pos ?? index) >= start && (elem?.tab_pos ?? index) < end);
}; };