Comments (8)
Hey @matfish2 ,
Thanks for a quick turn around on this.
A couple things:
- It appears that toggling one row toggles all of them?
- I would like to have the content render conditionally for each row (as in v-if) after starting off collapsed, and I am uncertain if this is the default behavior.
- It would also be nice to use straight HTML instead of the css switching for this. A toggle I would like to use is used like this:
<div class="togglebutton">
<label>
<input type="checkbox" v-model="historyVisible" v-bind:true-value="true" v-bind:false-value="false"><span class="toggle"></span>
</label>
</div>
So perhaps a more flexible way of handling this would be
options:{
...
child: {
row: function(h, row) {
return <div>My custom content for row {row.id}</div>
},
toggle: function(h, row) {
return ...
}
I haven't fully thought out that implementation, but hopefully that makes sense. It would also be a nice feature to allow the toggle position to be appended instead of prepended as well.
Great work!
from vue-tables-2.
- I couldn't replicate the one-toggler-toggles-all bug.
- I agree. I tried to use conditional rendering but it was more complicated than I thought, so I decided to use a class-based approach. I will give it another shot. In any case all rows start with a
closed
class, so if you set it todisplay:none
, like the docs demonstrate, you should have them all collapsed at first. - Not sure about this one. For one thing, using CSS is exactly the approach datatables are using. More importantly, I think it allows for more flexibility in terms of design, as opposed to being limited to a checkbox. Allowing for custom HTML for the toggler itself would be very problematic, because of the inherent logic, that the user would have to implement correctly himself. I think I will leave this one as it is.
from vue-tables-2.
- I am still getting the one one-toggler-toggles-all bug. Here's the relevant main.js, so perhaps I am misconfiguring something? https://gist.github.com/metamet/e13645ff5c5b2e9b9cfc6b3a7238b7d4
- This is understandable. Unfortunately the default styles you included in the manual aren't present in the build itself, so it requires external CSS to get child rows working and collapsed.
- Along with that, maybe including a default style in vue-tables-2 would be convenient? And perhaps an easy way of overriding it that doesn't require external css (since I am not using a .vue template for the table implementation--which maybe I should?--I have to put it on the home html page). Something like the following would be pretty universally applicable. Just thoughts here, though:
.VueTables__child-row-toggler {
width:16px;
height:16px;
line-height: 16px;
display: block;
margin: auto;
text-align: center;
}
.VueTables__child-row-toggler--closed::before {
content: "+";
}
.VueTables__child-row-toggler--open::before {
content: "-";
}
.VueTables__child-row--closed {
display: none;
}
Good work.
from vue-tables-2.
- Does your dataset have a unique
id
property? (see docs). This is necessary for keeping track of the toggle position for each row. - I have added your suggested styling to the docs, along with a dedicated
style.css
file.
from vue-tables-2.
It looks like my unique ID on this server-side request is actually RequestId. Is it possible to set the unique id property to a particular column?
from vue-tables-2.
I've added a childRowKey
option. Use it like so:
{
childRow: function(h, row) {
return <div>My Row Data</div>
},
childRowKey:"RequestId"
}
from vue-tables-2.
Beautiful. It's working. Glad to be your personal tester here, and thanks for the quick turnaround! Very helpful feature.
For future reference, in case someone comes across this, @matfish2 's example has an opening bracket, so the ending bracket is from that (caused me a slight moment of confusion, hah):
{
childRow: function(h, row) {
return <div>My Row Data</div>
},
childRowKey:"RequestId"
}
Great work, again.
from vue-tables-2.
As for appending rather than prepending the toggler, I've added a custom template option which allows you to duplicate the template and modify it to your needs. You can use this option for fine-grained control over the template. It is passed as the fourth argument to the Vue.use
statement. E.g:
Vue.use(VueTables.client, null, false, require('my-template.jsx')('client'))
from vue-tables-2.
Related Issues (20)
- Changelog HOT 3
- Row double click HOT 2
- Variables inside custom header not updating HOT 4
- Documentation of disabledChildRows option HOT 1
- Change header of toggle column HOT 2
- editable edits all rows on click HOT 1
- how to manage table refresh HOT 1
- MouseUp event conflicts with other MouseUp events HOT 2
- problem with virtual pagination height HOT 6
- grouping doesn't show data HOT 4
- evaluate removal of background: white from thead tr th HOT 2
- customize column header titles HOT 1
- [question] sort by attribute, show another HOT 2
- Replacing cell content issues HOT 2
- Custom components in vue 3 HOT 2
- Set initial listColumns in dropdown HOT 2
- Add 'large-desktop' columnDisplay value(s)
- xscode down HOT 41
- Does uniqueKey support nested objects? HOT 2
- How to access table data from custom template
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-tables-2.