Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No funciona el filtre Totes Completades Pendents #2

Closed
Marinsan opened this issue Dec 11, 2018 · 1 comment
Closed

No funciona el filtre Totes Completades Pendents #2

Marinsan opened this issue Dec 11, 2018 · 1 comment

Comments

@Marinsan
Copy link
Owner

Surten bé els noms però no fa la seva funció.

@Marinsan
Copy link
Owner Author

Al fitxer Tasques.vue
ruta: resources/js/components/Tasques.vue

S'han de canviar les línies:

      filter: 'Totes',
      filters: [ 'Totes', 'Completades', 'Pendents' ],

Per aquestes:

 filter: { name: 'Totes', value: null },
 filters: [{ name: 'Totes', value: null }, 
            { name: 'Completades', value: true }, 
            { name: 'Pendents', value: false }],

També cal afegir el computed getFilteredTasks:

  computed: {
    getFilteredTasks () {
      return this.dataTasks.filter((task) => {
        if (task.completed === this.filter.value || this.filter.value == null) return true
        else return false
      })
    }
  },

Per últim dins de l'etiqueta v-data-table editarem el parametre :items

:items="getFilteredTasks"

Revisar l'etiqueta v-select del nostre filtre que sigui amb els següents paràmetres:

                                label="Filtres"
                                :items="filters"
                                v-model="filter"
                                item-text="name"
                                :return-object="true"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant