-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
template is being rendered above the table #72
Comments
Hey @tonykaralis, |
Thanks @kouts that makes sense. I have been able to sort it with some jquery for the moment. Nice library by the way, solid work! |
The challenge described in the original post is not about styling, or so it seems to me. Because I am encountering this same issue when using a table, I took a screenshot of the generated DOM. The |
Hey @tonykaralis, there's an example on the If you can post a Stackblitz or a Codesandbox reproduction of your issue maybe we can pinpoint the problem. |
@kouts thanks for the link. I did manage to get this working last year and have closed the issue :) |
@kouts Sure. Here is a jsbin demo that replicates the issue. |
@kouts One workaround for the DOM placement of |
@tonykaralis - It would be interesting to know how you managed to resolve the issue. I have not found the reason why it is happening for me or whether it has anything to do with using Vue from a cdn script as I'm attempting to do (just trying to enhance an existing html page rather than make a full spa site). My current workaround involves using a hidden counter field to find the first instance of a dataset-item record, use
|
@tonykaralis check the docs here about why this issue happens. |
@mg1075 I am also using vue from a cdn, not running a spa app either. The library was dropping the data in a tbody above the table instead of inside it. So my solution was super simple, I find the body of data and put it where I want it inside the mount method. The function that gets called in my mount method. function positionDataInTable() {
//The dataset library seems to drop the data in a tbody above the table instad of inside it.
//This fixes it.
var tableBody = $('#bodyWithData');
$('#mainTable').append(tableBody);
} The html: <div class="col-md-12 table-responsive table-striped">
<table class="table table-sm" id="mainTable" style="font-size:1rem;">
<thead>
<tr>
<th class="border-top-0">Product</th>
<th v-for="(th, index) in cols" :key="th.field" :class="['sort', th.sort, 'border-top-0', 'font-weight-bold']" v-on:click="click($event, index)">
{{ th.name }} <i class="gg-select float-right"></i>
</th>
</tr>
</thead>
<!-- i have ided the body, this allows me to find and it put it where it belongs-->
<dataset-item tag="tbody" id="bodyWithData" class="mb-2">
<template v-slot="{ row, rowIndex }">
<tr style="cursor:pointer;">
<th class="table-cell-breakWord" v-on:click="getProductNormDetails(row.Id)">{{ row.Name }}</th>
td v-for="(col, colIndex) in cols" class="table-cell-breakWord text-center"> {getFieldData(colIndex, rowIndex)}}</td>
</tr>
</template>
<template #noDataFound>
<div class="alert alert-warning text-center">
No data found matching the selected search parameters!
</div>
</template>
</dataset-item>
</table>
</div> Hope this helps, I fixed this almost a hear ago, luckily I left a comment ;) |
@tonykaralis - Nice; thanks for sharing. The kludge I was using was adding a |
Why doesnt this happen in the official example? Also why would a tbody be hoisted out of a table as invalid?? |
Easiest thing to do is make sure your dataset is being rendered in a component, not by vue root...lame. |
Hi,
I have copied your code over and am trying to simply get the example working. As far as searching, sorting, paging etc everything works fine. The one thing that doesn't is the rendering of the datasetitems. I'm certain there is some config I am missing.
As you can see the rows appear above the table even though the html is as the example in the docs.
This is the code:
The text was updated successfully, but these errors were encountered: