#7136 - Enable paginate event in VnSelectFilter #255
|
@ -103,14 +103,13 @@ const arrayData = useURL.value
|
|||
: ref(null);
|
||||
onMounted(async () => {
|
||||
setOptions(options.value);
|
||||
if (!$props.options) fetchFilter($props.modelValue);
|
||||
jsegarra marked this conversation as resolved
Outdated
|
||||
if (useURL.value) {
|
||||
alexm
commented
Esta parte solo debe hacerla si hay url. Y por como esta ahora ya habria hecho la peticion al entrar en Esta parte solo debe hacerla si hay url. Y por como esta ahora ya habria hecho la peticion al entrar en `if (useURL.value)`
jsegarra
commented
Lo cambio para dejarlo asi Lo cambio para dejarlo asi
if (!$props.options) fetchFilter($props.modelValue);
|
||||
arrayData.store.userFilter = $props.where;
|
||||
arrayData.store.filter.where = $props.where;
|
||||
const { data } = await arrayData.fetch({ append: true });
|
||||
setOptions(data);
|
||||
return;
|
||||
}
|
||||
if (!$props.options) fetchFilter($props.modelValue);
|
||||
});
|
||||
|
||||
watch(modelValue, (newValue) => {
|
||||
|
@ -125,7 +124,7 @@ function filter(val, options) {
|
|||
|
||||
alexm
commented
El useLike no me lo quites pls El useLike no me lo quites pls
jsegarra
commented
hecho hecho
|
||||
if (!search) return options;
|
||||
|
||||
const optionsFiltered = options.filter((row) => {
|
||||
return options.filter((row) => {
|
||||
if ($props.filterOptions.length) {
|
||||
return $props.filterOptions.some((prop) => {
|
||||
const propValue = String(row[prop]).toLowerCase();
|
||||
|
@ -138,16 +137,15 @@ function filter(val, options) {
|
|||
|
||||
return id == search || optionLabel.includes(search);
|
||||
});
|
||||
|
||||
return optionsFiltered;
|
||||
}
|
||||
|
||||
async function fetchFilter(val) {
|
||||
if (!useURL.value || !dataRef.value) return;
|
||||
|
||||
const { fields, sortBy, limit } = $props;
|
||||
let key = null;
|
||||
if (new RegExp(/\d/g).test(val)) key = optionFilter.value ?? optionValue.value;
|
||||
let key = new RegExp(/\d/g).test(val)
|
||||
? optionFilter.value ?? optionValue.value
|
||||
jsegarra marked this conversation as resolved
Outdated
alexm
commented
Por como esta useArrayData, fetch no acepta los datos por paramtros. Solo Por como esta useArrayData, fetch no acepta los datos por paramtros. Solo `{ append = false, updateRouter = true }`
|
||||
: optionValue.value;
|
||||
|
||||
const where = { ...{ [key]: { like: `%${val}%` } }, ...$props.where };
|
||||
return dataRef.value.fetch({ fields, where, order: sortBy, limit });
|
||||
alexm
commented
Si de por si solo entra en fetchFilter si hay url, no hace falta separar la construccion del where en una funcion apart, que solo se usa en un sitio Si de por si solo entra en fetchFilter si hay url, no hace falta separar la construccion del where en una funcion apart, que solo se usa en un sitio
jsegarra
commented
Vale, lo debí separar para otra situación que acabé borrando y esto se quedó así Vale, lo debí separar para otra situación que acabé borrando y esto se quedó así
Lo limipio
|
||||
|
|
Loading…
Reference in New Issue
De primeras diria que esta linea no hace falta, dado que la primera ja lo hace
Pero quiero evitar que haga fetch
Un caso de uso sería: se lo declaro en el componente o una variable
updateRouter: false
sino podrá cosas en la url