Comments (6)
@thomasdola This is interesting! I've never thought of using it like this. :)
Let me think about it and I'll let you know.
from vue-table.
@thomasdola
I'm not sure how you set up your code, but if it was me I would do something like this.
I haven't tested this, but the idea is there.
<vuetable v-ref:regionsTable
api-url="/api/regions"
//...
:item-actions="regionActions"
></vuetable>
<vuetable v-ref:districtsTable
api-url="/api/districts"
//...
:item-actions="districtActions"
:append-params="districtParams"
></vuetable>
<vuetable v-ref:locationsTable
api-url="api/locations"
//...
:item-actions="locationActions"
:append-params="locationParams"
></vuetable>
new Vue({
el: '#app',
data: {
regionParams: [],
districtParams: [],
locationParams: [],
regionActions: [
{ name: 'select-region', label: '', icon: '...', class: '...' }
],
districtActions: [
{ name: 'select-district', label: '', icon: '...', class: '...' }
],
locationActions: [
]
},
events: {
'vuetable:action': function(action, data) {
if (action == 'select-region') {
this.districtParams = [
'filter=' + data.region
]
this.$nextTick(function() {
this.$refs.districtsTable.$broadcast('vuetable:refresh')
})
}
else if (action == 'select-district') {
this.locationParams = [
'filter=' + data.district
]
this.$nextTick(function() {
this.$refs.locationsTable.$broadcast('vuetable:refresh')
})
}
},
}
})
Please note that I'm not quite sure whether to use $broadcast
or $dispatch
here. If $broadcast
does not work, try $dispatch
instead and see how it goes.
from vue-table.
this is really cool .
i ll give a try.
thank you
from vue-table.
When I tried this approach $dispatch worked and $broadcast did not.
from vue-table.
"this.$refs.districtsTable.$broadcast('vuetable:refresh') "
It can not work.
from vue-table.
@xueweiyema What's the error? Does $dispatch work?
from vue-table.
Related Issues (20)
- Search with a extra data. HOT 6
- problem with scroll HOT 1
- Demo does not work in chrome HOT 4
- Error compiling template!!!! HELP ME!!! HOT 6
- Row totals HOT 3
- Is this an expected behavior of field callback?
- Can't style my grid to fit the content or a specific column HOT 2
- How use it for laravel HOT 1
- cell class cb
- Is it possible to add/del row dynamically? HOT 1
- unable to filter dates HOT 3
- No Data Available HOT 1
- Can I apply paging on client side? HOT 2
- Loading table with pre settings like sorting and page
- The word prev is spelled with the word next by mistake
- Pagination data not being transpile by polyfill
- Can i add `data-xxx` attribute to table head field? HOT 1
- http-fetch not showing data
- how to make columns resizable?
- How to use Cursor-Pagination
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-table.