-
Notifications
You must be signed in to change notification settings - Fork 25
Select nested child elements #6
Comments
Hi there! Have you applied the CSS 'selectorClass' class to the |
I use import dragSelect from './vendor/vue-drag-select'
const app = new Vue({
el: '#hallApp',
components: {
'drag-select-container': dragSelect
}
}) And I put my SVG right into template, inline: <div id="hallApp">
<drag-select-container selectorClass="cls-1">
<template scope="{ selectedItems }">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="6602.848 -554.785 878.112 543.45">
<g id="Group_1089" transform="translate(-957.152 -3588.785)">
<g id="Rectangle_1128" class="cls-1" data-sector="pew-2" data-row="row-1"
data-seat="0" transform="translate(7812.659 3529.023)">
<rect class="cls-7" width="10.221" height="10.221"/>
<rect class="cls-8" x="0.1" y="0.1" width="10.021" height="10.021"/>
</g>
</g>
…
</svg>
</template>
</drag-select-container>
</div> It's a map of a concert hall. I handle clicks on elements with I want to select a multiple I added If I use regular HTML elements into <template>
<drag-select-container selectorClass="cls-1">
<template scope="{ selectedItems }">
<div class="cls-1">
…
</template>
</drag-select-container>
</template> In that case, |
Hi there! Thanks for demonstrating me your code. The reason why it's not working is because Vue Drag Select only looks one level deep for children. Since the A potential solution to this problem is to recursively look for children, though I'm not sure if that's a good idea. |
Why you think it's a bad idea? In that case, performance is due to library user, not on a library itself. You requires CSS class name for child elements, and it's obvious must be equal to CSS selector query. I see it like |
I agree. Let's refactor the code to allow nested child elements. |
Unfortunately no, nested child elements are currently not supported. Feel free to send a pull request, though! |
I need to select rows in a table build with BootstrapVue's b-table. Usage
[…]
|
Hi Jochen, thanks for showing interest in this project! Having a more composable way of defining the selectable items is definitely a better solution. Doing it this way, we should be able to get rid of the whole In my opinion, a more intuitive approach to this would be to define a property If we can get that to work properly, I'm definitely open to pull requests! |
Ok, good to know you are open to greater changes. |
Hi, I would really appreciate this functionality. @stephan281094 Are you planning accept this pull request and release new version? |
@JochenLutz I am also looking to use this with BootstrapVue's |
I tried to select
<g>
inside SVG inside my Vue app, but when I tried toconsole.log(el)
inisItemSelected
method, I just see<svg>
element in colsole.The text was updated successfully, but these errors were encountered: