Vue.js component does not receive prop - html

I would like to pass a ride to the show-ride-modal. When somebody clicks on the button show a modal will pop-up with the ride information.
<table class="table">
<thead>
<tr>
<th>Door</th>
<th>Van</th>
<th>Naar</th>
<th>Type</th>
<th>Datum</th>
</tr>
</thead>
<tbody>
<tr v-for="ride in rides">
<show-ride-modal :ride="ride"></show-ride-modal>
<td>{{ ride.user.name }}</td>
<td>{{ ride.location.from }}</td>
<td>{{ ride.location.to }}</td>
<td>{{ ride.type.name }}</td>
<td>{{ ride.date }}</td>
<td>
<a #click="show" class="btn-show">show</a>
<a v-link="{ name: 'ritten' }" class="btn-edit">Bewerk</a>
<a v-link="{ name: 'ritten' }" class="btn-delete">Remove</a>
</td>
</tr>
</tbody>
</table>
My show ride modal component:
<template>
<modal title="Bekijk rit">
<form class="Modal__form" #submit.prevent="createTopic">
<p>test</p>
<p>{{ ride.user.name }}</p>
</form>
</modal>
</template>
<script>
import Modal from './Modal.vue'
export default {
components: { Modal },
props: ['ride'],
data () {
return {
showLoader: false
}
}
}
</script>
The problem is that the ride is not being passed to the <show-ride-modal>. What could be wrong?

Related

Centering a button inside a table using css and bulma

I am using Bulma as a CSS frame to style my angular app, currently, I have a table that looks like this :
I am trying to make it look more like this :
How do I center the button and make the table look as close as it can to this one?
Here is the code I am using :
<table
class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth"
>
<thead>
<tr>
<th>SESSION_ID</th>
<th>CARD_NUMBER</th>
<th>TRANSACTION_AMOUNT</th>
<th>TERMINAL_ID</th>
<th>EXTERNAL_STAN</th>
<th>TRANSACTION_DATE</th>
</tr>
</thead>
<tbody>
<tr
*ngFor="
let row of MatchTransactions.onlyInFile1
| slice: 0:(page + 1) * 5;
let i = index
"
>
<td>{{ row.SESSION_ID }}</td>
<td>{{ row.CARD_NUMBER }}</td>
<td>{{ row.TRANSACTION_AMOUNT }}</td>
<td>{{ row.TERMINAL_ID }}</td>
<td>{{ row.EXTERNAL_STAN }}</td>
<td>{{ row.TRANSACTION_DATE }}</td>
</tr>
<tr>
<td class="is-centered" colspan="6">
<button
class="button"
*ngIf="
(page + 1) * 5 < MatchTransactions.onlyInFile1.length
"
(click)="page = page + 1"
>
Show more
</button>
</td>
</tr>
</tbody>
</table>
<tr>
<td class="has-text-centered" colspan="6">
<button class="button">Show more</button>
</td>
</tr>

Bootstrap Accordion with a table and dynamic number or rows

Having trouble getting Accordion collapse to work within a table and a dynamic number of rows. For some reason it is only collapsing the first item in the table and ignoring the following rows, even though I have the Id's for hidden rows set to a unique identifier (company number). The amount of rows that are in the table will be dynamic.
<table class="table table-condensed" style="border-collapse:collapse;">
<thead>
<tr>
<th>Company Name</th>
<th>Company Number</th>
<th>View Documents</th>
<th>Region</th>
<th>Type</th>
<th>Time Submitted</th>
<th>Mark as Completed</th>
</tr>
</thead>
<tbody>
{% for job in todo %}
<tr data-toggle="collapse" data-target="#{{ job.company_number }}" class="accordion-toggle">
<td>{{ job.name }}</td>
<td>{{ job.company_number }}</td>
<td><a href="#{{ job.company_number }}" aria-expanded="true">View</button></td>
<td>{{ job.jurisdiction }}</td>
<td>{{ job.job_type }}</td>
<td>{{ job.time_submitted|date:"d M Y"}}</td>
<td><a href="{% url 'mark_as_completed' %}?job_id={{ job.id }}">Mark as Completed</td>
</tr>
<tr>
<td colspan="6" class="hiddenRow">
<div id="{{ job.company_number }}" class="accordion-body collapse">Hello there!</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
The following test works for me with both rows. Is it possible that job.company_number has duplicate values? ID's must be unique for it to work correctly.
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<table class="table table-condensed" style="border-collapse:collapse;">
<thead>
<tr>
<th>Company Name</th>
<th>Company Number</th>
<th>View Documents</th>
<th>Region</th>
<th>Type</th>
<th>Time Submitted</th>
<th>Mark as Completed</th>
</tr>
</thead>
<tbody>
<!-- Job 1 -->
<tr data-toggle="collapse" data-target="#company1" class="accordion-toggle">
<td>{{ job.name }}</td>
<td>{{ job.company_number }}</td>
<td><a href="#{{ job.company_number }}" aria-expanded="true">View</button></td>
<td>{{ job.jurisdiction }}</td>
<td>{{ job.job_type }}</td>
<td>{{ job.time_submitted|date:"d M Y"}}</td>
<td><a href="{% url 'mark_as_completed' %}?job_id={{ job.id }}">Mark as Completed</td>
</tr>
<tr>
<td colspan="6" class="hiddenRow">
<div id="company1" class="accordion-body collapse">Hello there!</div>
</td>
</tr>
<!-- Job 2 -->
<tr data-toggle="collapse" data-target="#company2" class="accordion-toggle">
<td>{{ job.name }}</td>
<td>{{ job.company_number }}</td>
<td><a href="#{{ job.company_number }}" aria-expanded="true">View</button></td>
<td>{{ job.jurisdiction }}</td>
<td>{{ job.job_type }}</td>
<td>{{ job.time_submitted|date:"d M Y"}}</td>
<td><a href="{% url 'mark_as_completed' %}?job_id={{ job.id }}">Mark as Completed</td>
</tr>
<tr>
<td colspan="6" class="hiddenRow">
<div id="company2" class="accordion-body collapse">Hello there!</div>
</td>
</tr>
</tbody>
</table>
Update: In response to your comment, would it be better to use job.id for the accordian id's like so?
<tr data-toggle="collapse" data-target="#{{ job.id }}" class="accordion-toggle">
<td colspan="6" class="hiddenRow">
<div id="{{ job.id }}" class="accordion-body collapse">Hello there!</div>
</td>

How to change position of a table in vuejs?

Currently it is as follows:
In fact it was to stay like this;
I’m having trouble, can anyone help me, please?
This is the source code.
<div id="app">
<table class="table">
<thead>
<tr>
<th>Tipo de moeda</th>
<th>Valor</th>
<th>Referencia</th>
</tr>
</thead>
<tbody>
<tr v-if="bancodedados" v-for="(val, key) in bancodedados.valores" :key="key">
<td> {{ val.nome }} </td>
<td> {{ val.valor }}</td>
<td>{{ val.fonte }}</td>
</tr>
</tbody>
</table>
</div>
i think you should return your data horizontally. Otherwise you can define like this.
computed: {
dolar () {
return this.bancodedados.valores[0].valor;
},
euro () {
return this.bancodedados.valores[1].valor;
},
btc () {
return this.bancodedados.valores[2].valor;
}
...
}
or you can use created statement to return data
data: {
dolar: 0,
euro: 0,
btc: 0
},
created() {
this.dolar = this.bancodedados.valores[0].valor;
this.euro = this.bancodedados.valores[1].valor;
this.btc = this.bancodedados.valores[2].valor
...
}
your table should like this in both cases
<table class="table">
<thead>
<tr>
<th>Dola</th>
<th>Euro</th>
<th>BTC</th>
</tr>
</thead>
<tbody>
<tr>
<td> {{ dolar }} </td>
<td> {{ euro }} </td>
<td> {{ btc }} </td>
</tr>
</tbody>
</table>

How can I add a horizontal scroll bar at bottom of this table?

The table contains large amount of columns such that when the browser is restored down the last columns are invisible to the user. I want to add a horizontal scroll bar at the bottom of the table so the user can drag it and see the last columns.
<div class="col-md-12 well">
<div id="double-scroll">
<table id="dataGrid" class="dataGrid display dataTable" cellspacing="0" width="100%">
<thead>
<tr>
<th style="display:none;"> </th>
<th>{{ Lang::get('messages.Event_Name') }} </th>
<th>{{ Lang::get('messages.organization_name') }}</th>
<th>{{ Lang::get('messages.Event_Start_Date') }} </th>
<th>{{ Lang::get('messages.Event_End_Date') }} </th>
<th>{{ Lang::get('messages.Event_Start_Time') }} </th>
<th>{{ Lang::get('messages.Event_End_Time') }} </th>
<th>{{ Lang::get('messages.Event_Location') }} </th>
<th>{{ Lang::get('messages.Event_Venue') }} </th>
<th>{{ Lang::get('messages.Event_Url') }} </th>
<th>{{ Lang::get('messages.Created_Date') }} </th>
<th> </th>
<th> </th>
<th> </th>
</tr>
</thead>
<tfoot>
<tr>
<th style="display:none;"> </th>
<th>{{ Lang::get('messages.Event_Name') }} </th>
<th>{{ Lang::get('messages.organization_name') }}</th>
<th>{{ Lang::get('messages.Event_Start_Date') }} </th>
<th>{{ Lang::get('messages.Event_End_Date') }} </th>
<th>{{ Lang::get('messages.Event_Start_Time') }} </th>
<th>{{ Lang::get('messages.Event_End_Time') }} </th>
<th>{{ Lang::get('messages.Event_Location') }} </th>
<th>{{ Lang::get('messages.Event_Venue') }} </th>
<th>{{ Lang::get('messages.Event_Url') }} </th>
<th>{{ Lang::get('messages.Created_Date') }} </th>
<th> </th>
<th> </th>
<th> </th>
</tr>
</tfoot>
<tbody id="mailTableBody">
#foreach ($liveEvents as $value)
<tr role="row" class="odd">
<td style="display:none;" class="sorting_1">{{ $value->id }}</td>
<td>{{ $value->eventName }}</td>
<td>{{ $value->organizationName }}</td>
<td>{{ $value->startDate }}</td>
<td>{{ $value->endDate }}</td>
<td>{{ $value->startTime }}</td>
<td>{{ $value->endTime }}</td>
<td>{{ $value->location }}</td>
<td>{{ $value->Venue }}</td>
<td><a class="btn btn-danger" style ="height: 32px;" href="{{ $value->publicURL }}" >{{Lang::get('messages.register')}}</a></td>
<td>{{ $value->created_at }}</td>
<td><button onclick="watchnow(this)" class="btn btn-success" style ="width: 150px; float: right" >{{Lang::get('messages.watchnow')}}</button></td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
Found the best answer..
<style type="text/css">
#double-scroll { overflow: auto; overflow-y: hidden; }
#double-scroll p { margin: 0; padding: 1em; white-space: nowrap; }
</style>
Add this style:
#datagrid{
overflow-x: scroll;
}
you add css code below:
<style type="text/css">
#double-scroll {
overflow:scroll
}
</style>
please code above inside <head>
Note: overflow-x and overflow-y support on latest version of browser if you want to support old ie you need to use overflow:scroll

make a row clickable in html

I am trying to make a table's rows clickable, by calling a controller (am using symfony) and i found this solution, but the problem i have is that even the titles of the row is clickable and leads me to an error, and the other problem is that when i customize the hover it's applied on all the rows even if i use a class or specified the style inside the <tr>
Here is my code
<table class="table table-hover ">
<thead>
<tr>
<th>N°</th>
<th>Titre</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{% for key, rech in recherche %}
<tr style="cursor: pointer;">
<td>{{ loop.index }}
</td>
<td>{{ rech.titre | raw }}</td>
<td>{{ rech.date | date('Y-m-d') |raw }}</td>
</tr>
{% endfor %}
</tbody>
</table>
Thanks for your response.
You can try this solution below.
EDIT
Make sure you add this reference in your header section
EDIT
put the js code in a file, and put this at the bottom of the page before the body close.
<script src="/path/filename.js">
Goes in the header
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
DEMO
<table class="table table-hover ">
<thead>
<tr>
<th>N°</th>
<th>Titre</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{% for key, rech in recherche %}
<tr data-href="{{ path('resultat',{'id':rech.id}) }}">
<td>{{ loop.index }}</td>
<td>{{ rech.titre | raw }}</td>
<td>{{ rech.date | date('Y-m-d') |raw }}</td>
</tr>
{% endfor %}
</tbody>
</table>
js
$(function(){
$(document).on('click', '[data-href]', function () {
var url = $(this).data('href');
if (url && url.length > 0) {
document.location.href = url;
return false;
}
});
});
css
.table-hover tbody tr {
background: #dcdcdc;
pointer: cursor;
}
hello we just add the link for Jquery
<script src="../jquery.min.js"></script>
<table>
<thead style="display: none">
<tr>
<th>Id</th>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr class="tablerowproject" data-href="{{ path('company_index') }}">
<td><i class="step fi-lightbulb" style="font-size: 60px; color: #FBFCF7 "></i></td>
<td>{{ project.name }}</td>
<td>
<ul>
<li>
show
</li>
<li>
edit
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
and add this lines
<script type="text/javascript">
$(document).ready(function(){
$(".tablerowproject").click(function() {
window.document.location = $(this).data("href");
});
})
</script>
add in your file CSS add this
.tablerowproject {
display: block;
background-color: #345d71;
border-radius: 5px;
cursor: pointer;
}
.tablerowproject:hover{
background-color: #092636;
}
and this my result