Topic: datatables rows with computed props
Jackel27 pro asked 2 years ago
I am using the datatable for Vue, my current table has a v-model referencing the data for the table. I am however using Vuex for a state, I have a computed property for my Vuex state. How do I reference that into my Data.rows ?
For instance, I have an array of, let's say "members" in my Vuex store state called "members"
Members = [{...}, ...]
in my component, I created a computed property called "Members ()"
return this.$store.state.Members
Now, in my datatable v-model reference, How do I use my computed property in place for the Rows array ?
I cannot do this, but it would be nice if I could
rows: this.Members
So my question is, how do I use a computed property for my rows ???
Jackel27 pro answered 2 years ago
Figured out a work around. Just took my "data" from my datatable, moved it into a computed property, along with the rows pointing to my Vuex State, then just returned the entire data model for the datatable by referencing it as a computed prop.
Mikołaj Smoleński staff commented 2 years ago
Thanks for posting an answer.
Keep coding, Mikołaj from MDB
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: MDB Vue
- MDB Version: MDB5 1.12.0
- Device: laptop
- Browser: chrome
- OS: win10
- Provided sample code: No
- Provided link: No