aareyes00's avatar

VueJS 2 Pagination + Table

Hi anyone,

Is there someone who can turn this fiddle to VUEJS2?

https://jsfiddle.net/os7hp1cy/48/

I'm trying to create a pagination and table out of this fiddle but it is vuejs ver 1. there's something wrong in v-for

0 likes
3 replies
samfrjn11's avatar

Hi,

Your problem is because of the filters used in the v-for

v-for="user in users | filterBy searchKey | paginate"

filters are removed in VueJS2

You have to make a computed property that filters the users and then iterate over this computed property.

computed: {
           usersFilteredBySearchKey: function () {
                const vm = this;
                return _.filter(vm.users, function (user) {
                    return _.includes(user.name, vm.searchKey);
                });
            },
}
aareyes00's avatar

Hey @samfrjn11, thanks but I tried it but still not working. Can you please give me a sample working fiddle? :)

Please or to participate in this conversation.