I hava a simple table, every tr is a link with a sepcific order, but I have to have one extra column n th with checking or this order is already in store. ( with checboxes ) I can't to this because when I add this, then all row i a link, but I want to this last column wasn't a link, but simple checboxes.
Here is my code:
<table class="table">
<tr>
<th>Order Number</th>
<th>Name</th>
<th>Tel</th>
<th>Email</th>
<th>Status</th>
<th>Order date</th>
<th>IS in store?</th>
</tr>
<router-link :to="'/orderDetail/'+order.id" tag="tr" v-for="order in orders" :key="order.number"
class="order-row">
<td>{{order.number}}</td>
<td>{{order.client_name}}</td>
<td>{{order.phone}}</td>
<td>{{order.email}}</td>
<td>{{order.actual_status}}</td>
<td>{{order.order_date}}</td>
<td>Here should be checbox with id of roder, but not as a link</td>
</router-link>
</table>
html css :
.order-row:hover td {
cursor: pointer;
transition-duration: 0.3s;
background-color: #EfEEEE;
border-top: 1px solid #e0093e;
border-bottom: 1px solid #e0093e;
color: #e0093e;
}
First create one method, something like this
orderRedirect: function(order) {
this.$router.replace('/orderDetail/' + order.id); // For Vuejs 2
this.$route.router.go('/orderDetail/' + order.id); //For Vuejs 1
},
Then call this function on click from table td, something like this
<table class="table">
<tr>
<th>Order Number</th>
<th>Name</th>
<th>Tel</th>
<th>Email</th>
<th>Status</th>
<th>Order date</th>
<th>IS in store?</th>
</tr>
<tr v-for="order in orders" class="order-row">
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.number}}</td>
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.client_name}}</td>
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.phone}}</td>
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.email}}</td>
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.actual_status}}</td>
<td #click="orderRedirect(order)" style="cursor: pointer">{{order.order_date}}</td>
<td><input type="checkbox"></td>
</tr>
</table>
This is one of way that you can remove link from checkbox td
Try something along the lines of:
<td><input type="checkbox" v-model="order.actual_status"></td>
Related
I am currently developing a tool and part of it calculates employees. I want to be able to get 12 numbers of thier row from different coloumns...
E.G.
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
<table>
<tr>
<th>Name</th>
<th>Data 1</th>
<th>Data 2</th>
<th>Data 3</th>
<th>Data 4</th>
<th>Data 5</th>
<th>Data 6</th>
<th>Data 7</th>
<th>Data 8</th>
<th>Data 9</th>
<th>Data 10</th>
<th>Data 11</th>
<th>Data 12</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>67</td>
<td>34</td>
<td>67</td>
<td>34</td>
<td>67</td>
<td>34</td>
<td>67</td>
<td>34</td>
<td>34</td>
<td>67</td>
<td>34</td>
<td>67</td>
</tr>
</table>
How to I add all of those together to make one number in php and display it on a dashboard? (Connects to MYSQL)
You can use jquery to get all td value and concate that and pass it to php file using ajax.
$('#mytable td').each(function() {
var cellText += $(this).html();
});
then pass this value to ajax call.
I am trying to style a <tr id="options"> generated by a PHP foreach() with jQuery, but everything I've tried only selects the first one, leaving the others intact. What can I do this? Simple example:
CSS:
td {border:1px solid black}
TABLE:
<table>
<tr>
<td>DATE</td>
<td>EXAM TITLE</td>
<td>EXAM CODE</td>
</tr>
<tr>
<td>TODAY</td>
<td>RANDOM</td>
<td>123</td>
</tr>
<tr>
<td>BUTTON</td>
<td>BUTTON</td>
<td>BUTTON</td>
</tr>
<tr>
<td colspan=3 id="options">
</tr>
I have tried this jQuery code (among other):
$("table").find("#options").each(function(){
$(this).css("border","0px");
});
It only styles my first <td id="options">. How can I get all of them?
Sorry if it is a stupid question. Thanks for the help.
convert id to classlike:- <td class="options">..</td>
and then you can use(Use Either-one)
CSS (standered way):-
td.options {border:1px solid black}
Or jQuery(try to avoid as much as possible):-
$('.options').css("border","1px solid black"); // no need of each
Example (both at same time):-
$('.options').css("font-size","21px");
td.options {border:1px solid black}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<td class="options">DATE</td>
<td class="options">EXAM TITLE</td>
<td class="options">EXAM CODE</td>
</tr>
<tr>
<td class="options">TODAY</td>
<td class="options">RANDOM</td>
<td class="options">123</td>
</tr>
<tr>
<td class="options">BUTTON</td>
<td class="options">BUTTON</td>
<td class="options">BUTTON</td>
</tr>
</table>
I created a table with fix table head. I use this simple CSS to do that.
.table-fixed thead {
width: 97%;
}
.table-fixed tbody {
width: 97%;
height: 340px;
display:block;
overflow:auto;
}
but the n the output will come like this;
I call the table from ajax. so here is the table code;
echo "<table class=\"table table-bordered table-fixed\">
<thead>
<tr>
<th class=\"col-xs-1\">No</th>
<th class=\"col-xs-2\">Name of Student</th>
<th class=\"col-xs-1\">Nic No</th>
<th class=\"col-xs-1\">Reg. No.</th>
<th class=\"col-xs-1\">adm. date</th>
<th class=\"col-xs-1\">room No</th>
<th class=\"col-xs-3\">Address</th>
<th class=\"col-xs-2\">Contact No.</th>
</tr>
</thead>
<tbody>";
$count = 1;
while($row = $result->fetch_assoc()) {
echo"
<tr id=\"".$row["reg_no"]."\" onclick=\"Redirect(this.id)\">
<td class=\"col-xs-1\">".$count."</td>
<td class=\"col-xs-2\">".$row["name_initial"]."</td>
<td class=\"col-xs-1\">".$row["nic"]."</td>
<td class=\"col-xs-1\">".$row["reg_no"]."</td>
<td class=\"col-xs-1\"></td>
<td class=\"col-xs-1\"></td>
<td class=\"col-xs-3\">".$row["resedential_adress"]."</td>
<td class=\"col-xs-2\">".$row["contact_no"]."</td></tr>
";
$count++;
}
echo "
</tbody></table>";
}
please Help me to fix this problem.
Remove display:block; from table-fixed tbody {} It will override default table property
.table-fixed thead {
width: 97%;
}
.table-fixed tbody {
width: 97%;
height: 340px;
overflow:auto;
}
issue is in your css
remove display:block; and try
i have to show 3 columns in List view.
I tried having table inside <li><table></table></li> but its not looking good.
Is there any way to show 3 columns in list view.?
I tried ui-grid-b for 3 columns. but CSS issues...jsfiddle.net/9ZBAS/1
I tried and i could see columns overlapping if i use href and working find if not using href but without href i couldnt get the next icon button.
Any help?
try this one
<li >
<div class="ui-grid-b">
<div class="ui-block-a">Block A</div>
<div class="ui-block-b">Block B</div>
<div class="ui-block-c">Block C</div>
</div>
</li>
check this link;;
http://jquerymobile.com/test/docs/content/content-grids.html
Edited
Check this one
http://jsfiddle.net/9ZBAS/47/
Alternative to the Grid layout, using tables. This is not well documented in jQM
http://jquerymobile.com/demos/1.1.0/docs/content/content-html.html
HTML:
<table summary="This table lists all the JetBlue flights.">
<caption>
Travel Itinerary
</caption>
<thead>
<tr>
<th scope="col">Flight:</th>
<th scope="col">From:</th>
<th scope="col">To:</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="5">Total: 3 flights</td>
</tr>
</tfoot>
<tbody>
<tr>
<th scope="row">JetBlue 983</th>
<td>Boston (BOS)</td>
<td>New York (JFK)</td>
</tr>
<tr>
<th scope="row">JetBlue 354</th>
<td>San Francisco (SFO)</td>
<td>Los Angeles (LAX)</td>
</tr>
<tr>
<th scope="row">JetBlue 465</th>
<td>New York (JFK)</td>
<td>Portland (PDX)</td>
</tr>
</tbody>
</table>
CSS:
<style type="text/css">
table { width:100%; }
table caption { text-align:left; }
table thead th { text-align:left; border-bottom-width:1px; border-top-width:1px; }
table th, td { text-align:left; padding:6px;}
</style>
View:
Related:
JQuery Mobile Table
I am trying to setup a table column width to only 200px or 10%. However, when I populate the data from the database, the column seems to ignore the column width and expand it as much as it can. Here is my table html.
<table>
<thead>
<tr>
<th><a href='#'>City</a></th>
<th width='200' class='table_width'><a href='#'>name</a></th>
<th><a href='#'>Agent</a></th>
<th>...
//I have tried class and width attribute. both don't work.
</tr>
</thead>
<tbody>
<tr>
//these column data were popluated from database
<td><?= $row->city; ?></td>
<td width='200' class='table_width'><?= $row->_name; ?></td>
//ignore the width and expand the table cell.
<td><?= $row->agent; ?></td>
<td>...
</tr>
You want to use word-wrap:break-word;.
http://jsfiddle.net/RF4F6/1/
HTML
<table>
<thead>
<tr>
<th>Col 1</th>
<th>Col 2</th>
<th>Col 3</th>
<th>Col 4</th>
<th>Col 5</th>
</tr>
</thead>
<tbody>
<tr>
<td>Normal Width</td>
<td>Normal Width</td>
<td class="forcedWidth">hiThisIsAreallyLongStringThatWillHaveToWrapAt200PixelsOrI'llBeUnhappyAndYouWon'tLikeMeWhenI'mUnhappy.</td>
<td>Normal Width</td>
<td>NormalWidth</td>
</tr>
</tbody>
</table>
CSS
table td{
padding:.5em; /* Not essential for this answer, just a little buffer for the jsfiddle */
}
.forcedWidth{
width:200px;
word-wrap:break-word;
display:inline-block;
}
This is the standard behaviour of a table cell.
One way to do this is place a div inside your cells with style="width: 200px; overflow-hidden;"
Using table-layout: fixed for table will force browser to maintain specified dimensions.