jquery sortable table problems / laravel - javascript

I am using tableclothjs and Twitter Bootstrap. For some reason this code will not appear with the sortable headers like tableclothjs talks about in its API documentation. I've checked the JavaScript console in my web browser and I don't get any warnings or errors.
What could be going on here?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ticket .::. Show View</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Mobile Specific Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- Stylesheets -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id="container" style="text-align: justify; margin-left: auto; margin-right: 360px; margin-top: auto; width: 70%">
<div id="navigation"
style="margin-left: -3%; background-image: url('//static.fiberhop.com:8080/images/logo.png'); background-repeat: no-repeat">
<img src="//static.fiberhop.com:8080/images/logo.png" alt="FiberHop LLC Logo"/>
<span style="vertical-align: -20%; margin-left: 20%; text-align: justify; font-size: 250%; font-style: oblique">
<a>Link 1</a> | <a>Link 2</a> | <a>Link 3</a> | <a>Link 4</a> | <a>Link 5</a>
</span>
</div>
<table class="table table-sortable">
<thead>
<tr>
<th>Ticket ID</th>
<th>Customer ID</th>
<th>Category ID</th>
<th>Assigned</th>
<th>Employee ID</th>
<th>Subject</th>
</tr>
</thead>
<tbody>
<tr>
<td> 7</td>
<td> 17</td>
<td> 91</td>
<td style="text-align: center"> </td>
<td> 8239</td>
<td> Ea.</td>
</tr>
<tr>
<td> 13</td>
<td> 86</td>
<td> 41</td>
<td style="text-align: center"> assigned </td>
<td> 7612</td>
<td> Molestias veritatis.</td>
</tr>
<tr>
<td> 16</td>
<td> 24</td>
<td> 59</td>
<td style="text-align: center"> </td>
<td> 7484</td>
<td> Tenetur qui.</td>
</tr>
<tr>
<td> 25</td>
<td> 37</td>
<td> 70</td>
<td style="text-align: center"> assigned </td>
<td> 8060</td>
<td> Alias atque.</td>
</tr>
<tr>
<td> 31</td>
<td> 53</td>
<td> 72</td>
<td style="text-align: center"> </td>
<td> 5159</td>
<td> Non.</td>
</tr>
<tr>
<td> 46</td>
<td> 25</td>
<td> 28</td>
<td style="text-align: center"> assigned </td>
<td> 7827</td>
<td> Repellat.</td>
</tr>
<tr>
<td> 48</td>
<td> 42</td>
<td> 3</td>
<td style="text-align: center"> assigned </td>
<td> 6352</td>
<td> Ratione.</td>
</tr>
<tr>
<td> 50</td>
<td> 76</td>
<td> 3</td>
<td style="text-align: center"> assigned </td>
<td> 8880</td>
<td> Voluptatum magnam.</td>
</tr>
<tr>
<td> 52</td>
<td> 81</td>
<td> 96</td>
<td style="text-align: center"> </td>
<td> 7008</td>
<td> Occaecati reprehenderit.</td>
</tr>
<tr>
<td> 54</td>
<td> 18</td>
<td> 94</td>
<td style="text-align: center"> assigned </td>
<td> 3695</td>
<td> Aut quos.</td>
</tr>
<tr>
<td> 57</td>
<td> 70</td>
<td> 84</td>
<td style="text-align: center"> </td>
<td> 6093</td>
<td> Quod blanditiis.</td>
</tr>
<tr>
<td> 58</td>
<td> 50</td>
<td> 24</td>
<td style="text-align: center"> assigned </td>
<td> 7247</td>
<td> A animi.</td>
</tr>
<tr>
<td> 67</td>
<td> 42</td>
<td> 15</td>
<td style="text-align: center"> assigned </td>
<td> 5166</td>
<td> Aspernatur nihil.</td>
</tr>
<tr>
<td> 68</td>
<td> 41</td>
<td> 100</td>
<td style="text-align: center"> </td>
<td> 7335</td>
<td> Quia.</td>
</tr>
<tr>
<td> 73</td>
<td> 90</td>
<td> 34</td>
<td style="text-align: center"> </td>
<td> 7539</td>
<td> Eveniet.</td>
</tr>
<tr>
<td> 83</td>
<td> 54</td>
<td> 17</td>
<td style="text-align: center"> assigned </td>
<td> 3750</td>
<td> Nulla totam.</td>
</tr>
<tr>
<td> 84</td>
<td> 38</td>
<td> 92</td>
<td style="text-align: center"> assigned </td>
<td> 7408</td>
<td> Exercitationem.</td>
</tr>
<tr>
<td> 88</td>
<td> 21</td>
<td> 26</td>
<td style="text-align: center"> assigned </td>
<td> 5036</td>
<td> Alias consequatur.</td>
</tr>
<tr>
<td> 90</td>
<td> 34</td>
<td> 36</td>
<td style="text-align: center"> assigned </td>
<td> 3672</td>
<td> Neque.</td>
</tr>
<tr>
<td> 91</td>
<td> 22</td>
<td> 36</td>
<td style="text-align: center"> assigned </td>
<td> 8735</td>
<td> Non officia.</td>
</tr>
</tbody>
</table>
<ul class="pager">
<li class="disabled"><span>« Previous</span></li><li>Next »</li> </ul>
</div>
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.18.3/js/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("table").tablecloth({
theme: "default",
bordered: true,
condensed: true,
striped: true,
sortable: true,
clean: true,
cleanElements: "th td"
});
});
</script>
</body>
</html>

The tablecloth script appears to be missing from what I'm seeing. This works.
http://jsfiddle.net/bcafj8y0/
Added
<script type="text/javascript" src="http://cdn.lukej.me/jquery.tablecloth/1.0.0/js/jquery.tablecloth.js"></script>

Related

How to select checkbox selection serially. JQuery or JavaScript

I have a education management system. I want to apply a condition If select January then check February. Without selection January no body can select February.
If anyone select January, February, March. Then uncheck January. Automatically uncheck February and March.
Here is my html code. How can i applay in here jquery or javascript.
<table>
<tbody>
<tr>
<th>January</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall1" onclick="selectAll1(this,'color1')">
</td>
<td>7000</td>
</tr>
<tr>
<th>February</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall2" onclick="selectAll2(this,'color2')">
</td>
<td>800</td>
</tr>
<tr>
<th>March</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall3" onclick="selectAll3(this,'color3')">
</td>
<td>800</td>
</tr>
<tr>
<th>April</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall4" onclick="selectAll4(this,'color4')">
</td>
<td>800</td>
</tr>
<tr>
<th>May</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall5" onclick="selectAll5(this,'color5')">
</td>
<td>800</td>
</tr>
<tr>
<th>June</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall6" onclick="selectAll6(this,'color6')">
</td>
<td>800</td>
</tr>
<tr>
<th>July</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall7" onclick="selectAll7(this,'color7')">
</td>
<td>800</td>
</tr>
<tr>
<th>August</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall8" onclick="selectAll8(this,'color8')">
</td>
<td>800</td>
</tr>
<tr>
<th>September</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall9" onclick="selectAll9(this,'color9')">
</td>
<td>800</td>
</tr>
<tr>
<th>October</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall10" onclick="selectAll10(this,'color10')">
</td>
<td>800</td>
</tr>
<tr>
<th>November</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall11" onclick="selectAll11(this,'color11')">
</td>
<td>800</td>
</tr>
<tr>
<th>December</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall12" onclick="selectAll12(this,'color12')">
</td>
<td>800</td>
</tr>
<tr class="info">
<th>Grand Total</th>
<td></td>
<th>15800</th>
</tr>
</tbody>
</table>
Interesting challenge
This works as I understand the specs
const $months = $("[data-color]");
$months.on("click", function() {
const idx = $months.index(this)
if (this.checked && idx > 0) { // only check from Feb onwards
const checked = $("[data-color]:lt(" + idx + ")").map(function() { return this.checked }).get()
this.checked = checked.every(c => c); // only allow checking if previous are checked
} else $("[data-color]:gt(" + idx + ")").prop("checked", false)
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<table>
<tbody>
<tr>
<th>January</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall1" data-color="color1">
</td>
<td>7000</td>
</tr>
<tr>
<th>February</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall2" data-color="color2">
</td>
<td>800</td>
</tr>
<tr>
<th>March</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall3" data-color="color3">
</td>
<td>800</td>
</tr>
<tr>
<th>April</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall4" data-color="color4">
</td>
<td>800</td>
</tr>
<tr>
<th>May</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall5" data-color="color5">
</td>
<td>800</td>
</tr>
<tr>
<th>June</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall6" data-color="color6">
</td>
<td>800</td>
</tr>
<tr>
<th>July</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall7" data-color="color7">
</td>
<td>800</td>
</tr>
<tr>
<th>August</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall8" data-color="color8">
</td>
<td>800</td>
</tr>
<tr>
<th>September</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall9" data-color="color9">
</td>
<td>800</td>
</tr>
<tr>
<th>October</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall10" data-color="color10">
</td>
<td>800</td>
</tr>
<tr>
<th>November</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall11" data-color="color11">
</td>
<td>800</td>
</tr>
<tr>
<th>December</th>
<td style="text-align: center;">
<input type="checkbox" class="check" id="selectall12" data-color="color12">
</td>
<td>800</td>
</tr>
<tr class="info">
<th>Grand Total</th>
<td></td>
<th>15800</th>
</tr>
</tbody>
</table>
You can have a helper function to determine every time someone tries toggling the checkbox. Your set of condition would go there, if true, let them toggle, else don't.
You could generate an object with month name and number of months prior.
{ "JANUARY": 0, ..., "JULY": 6, ..., "DECEMBER": 11 }
This way you just have to track the count of rows before to decide whether the toggleRequest is allowed for a particular checkbox or not.

JavaScript sum table value

I have the HTML table below. How can I sum up all of the columns based on continent group?
<html>
<table border="1">
<tr>
<th>Continent</th>
<th>Population</th>
</tr>
<tr>
<td>
<center>Total</center>
</td>
<td>
<center>sum(continent)???</center>
</td>
</tr>
<tr>
<td>
<center>Asia</center>
</td>
<td>
<center>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;">IND</font>
</td>
<td>
<font style="float:right;">900,000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;">JPY</font>
</td>
<td>
<font style="float:right;">25,000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;">CHN</font>
</td>
<td>
<font style="float:right;">9,000</font>
</td>
</tr>
<tr>
<td>
<center>Europe</center>
</td>
<td>
<center>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;">RUS</font>
</td>
<td>
<font style="float:right;">3,000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;">ITA</font>
</td>
<td>
<font style="float:right;">5,000</font>
</td>
</tr>
<tr>
<td>
<center>Others</center>
</td>
<td>
<center>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;">OTH</font>
</td>
<td>
<font style="float:right;">90,000</font>
</td>
</tr>
</table>
</html>
Example: in order to get the Total, I need to add all of the continents, in this case Asia + Europe + Others, but first I need to have the subtotal of those continents. Additional info: Those continents and nations can be editable(add/remove) based on database. How can I do that?
In simple terms, like using Microsoft Excel, where we can sum up each/any column that we want.
I know JavaScript sum() that I got from other sites, but so far it only gives me the total for all column values. Below is the code, where index equals to number of column.
function sumColumn(index) {
var total = 0;
$("td:nth-child(" + index + ")").each(function() {
total += parseFloat($(this).text(), 10) || 0;
});
return total.toFixed(2);
}
If you're trying to learn on how to use Jquery Selectors, I've modified the snippet according to what you have mentioned. However, what you are trying to do here is a bad way of handling data. You should never represent data in this form. Use PHP or ajax to load data to the elements.
$(function() {
let asia_sum = 0;
$('.asia').each( function() {asia_sum+= parseInt($(this).text()); });
let eur_sum = 0;
$('.eur').each( function() {eur_sum+= parseInt($(this).text()); });
let other_sum = 0;
$('.other').each( function() {other_sum+= parseInt($(this).text()); });
let total = asia_sum + eur_sum + other_sum;
$('#total').text(total);
$('#eur').text(eur_sum);
$('#asia').text(asia_sum);
$('#other').text(other_sum);
console.log(other_sum);
});
<html>
<head><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script></head>
<body>
<table border="1">
<tr>
<th>Continent</th>
<th>Population</th>
</tr>
<tr>
<td>
<center>Total</center>
</td>
<td>
<center id='total'>sum(continent)???</center>
</td>
</tr>
<tr>
<td>
<center >Asia</center>
</td>
<td>
<center id='asia'>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;" >IND</font>
</td>
<td>
<font style="float:right;" class='asia'>900000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;">JPY</font>
</td>
<td>
<font style="float:right;" class='asia'>25000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;" >CHN</font>
</td>
<td>
<font style="float:right;" class='asia'>9000</font>
</td>
</tr>
<tr>
<td>
<center>Europe</center>
</td>
<td>
<center id='eur'>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;" >RUS</font>
</td>
<td>
<font style="float:right;" class='eur'>3000</font>
</td>
</tr>
<tr>
<td>
<font style="float:right;">ITA</font>
</td>
<td>
<font style="float:right;" class='eur'>5000</font>
</td>
</tr>
<tr>
<td>
<center>Others</center>
</td>
<td>
<center id='other'>sum(nation)??</center>
</td>
</tr>
<tr>
<td>
<font style="float:right;" >OTH</font>
</td>
<td>
<font style="float:right;" class='other'>90000</font>
</td>
</tr>
</table>
</body>
</html>

find td elements which do not have checkbox with class

How to find the td elements in a table which do not have checkboxes with the class name as chkCheckBox1
Created this fiddle
I've tried to use .filter and find the td but that didn't worked.
$("#LstDocTemp").filter("td:not(.chkCheckBox1)")
Any help would be appreciated
You can use :not() and :has() like this DEMO
$("td:not(:has(input.chkCheckBox1:checkbox))")
This also works. Single selector up front to get the input itself, then the containing TD.
$(function(){
var mySelection = $("#LstDocTemp td input:not(.chkCheckBox1)").parent();
console.log(mySelection)
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table id="LstDocTemp" border="0" cellpadding="0" cellspacing="0" class="instruction_grid">
<tr>
<th align="left" class="ins_sl_no">
Sl No.
</th>
<th align="left" class="selct_column">
<input type="checkbox" id="chkSelectAll" name="chkSelectAll" />
</th>
<th align="left" class="doc_title_1">
Document title
</th>
<th align="left" class="description">
Description
</th>
<th align="center" class="revision">
Revision
</th>
<th align="left" class="part_no">
Parts name
</th>
<th align="center" class="issue_no">
Issue
</th>
<th align="center">
Link
</th>
</tr>
<tr>
<td>
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox" id="chkbox_" />
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox1" id="chkbox_" />
</td>
<td>
Test
</td>
<td class="dark_highlight">
</td>
<td>
</td>
<td class="light_highlight">
</td>
<td>
<a class="icon_add" title="Add">Add</a>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox" id="Checkbox1" />
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox1" id="Checkbox1" />
</td>
<td>
Test
</td>
<td class="dark_highlight">
</td>
<td>
</td>
<td class="light_highlight">
</td>
<td>
<a class="icon_add" title="Add">Add</a>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox" id="Checkbox2" />
</td>
<td>
<input type="checkbox" name="chkItem" class="chk chkCheckBox1" id="Checkbox2" />
</td>
<td>
Test
</td>
<td class="dark_highlight">
</td>
<td>
</td>
<td class="light_highlight">
</td>
<td>
<a class="icon_add" title="Add">Add</a>
</td>
</tr>
</table>

Issues with ui bootstrap modal CSS and printing

I am creating a webpage using angularjs and ui bootstrap to create modals. Then I have javascript to print just the modal. However, I am having an issue with my CSS. Firstly, for some reason (most likely because my CSS is messed up) the text is extending outside the div they belong in. Specifically, the ingredients and nutrition facts within the div with the class "onerow" are extending below the div with the class "modal-body".
Here is the plunker: http://plnkr.co/edit/fxvD6MTvbEHsaonLR669?p=preview
Furthermore, I have some javascript to print just the modal pane. It seems to work except for the fact that for some reason the thick solid black borders in the nutrition facts become borders with rounded corners. Again, refer to the plunker to better see what I am talking about.
Here is the html that makes up the modal:
<div class="modal-header" id="modalHeader" style="text-align: center;">
<h3 class="modal-title">PLU# {{productData.PLU}} -- {{productData.Dept}}</h3>
</div>
<div class="modal-body" id="modalBody">
<div ng-show="!pluValid" style="text-align:center;">
PLU {{productData.PLU}} not found in Database
</div>
<div class="onerow" ng-show="pluValid">
<div class="col6">
<div style="text-align: center;">{{productData.Desc1}} {{productData.Desc2}}</div>
<br />
<br />
Ingredients:
<br />
{{productData.Ingredients}}
<br />
<br />
<br />
<div style="text-align: center;">
<b>UPC NUMBER</b>
<br />
{{productData.UPC}}
</div>
</div>
<div class="col6 last" id="nutritionfacts" ng-show="!areFacts">
<table style="width:100%;" cellspacing:0 cellpadding:0>
<tbody>
<tr>
<td style="text-align: center;" class="header">Nutrition Facts</td>
</tr>
<tr>
<td style="text-align: center;">N/A</td>
</tr>
</tbody>
</table>
</div>
<div class="col6 last" id="nutritionfacts" ng-show="areFacts">
<table style="width:100%;" cellspacing:0; cellpadding:0;>
<tbody>
<tr>
<td style="text-align: center;" class="header">Nutrition Facts<br /><br /></td>
</tr>
<tr>
<td>
Serving Size {{productData.ServSize}}
<br />
Servings Per Container {{productData.ServPer}}
</td>
</tr>
<tr style="height: 7px">
<td style="background-color: #000000;"></td>
</tr>
<tr>
<td>
<div class="line">Amount Per Serving</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">Calories
<div class="weight">{{productData.Calories}}</div>
</div>
<div style="padding-top: 1px; float: right;" class="labellight">Calories from Fat
<div class="weight">{{productData.CaloriesFat}}</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<br />
<div class="dvlabel" style="text-align: right;">% Daily Value<sup>*</sup></div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">Total Fat
<div class="weight">{{productData.TotalFat}}g</div>
</div>
<div class="dv">{{productData.PerFat}}%</div>
</div>
</td>
</tr>
<tr>
<td class="indent">
<div class="line">
<div class="labellight">Saturated Fat
<div class="weight">{{productData.SatFat}}g</div>
</div>
<div class="dv">{{productData.PerSatFat}}%</div>
</div>
</td>
</tr>
<tr>
<td class="indent">
<div class="line">
<div class="labellight">Trans Fat
<div class="weight">{{productData.TransFat}}g</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">Cholesterol
<div class="weight">{{productData.Cholesterol}}mg</div>
</div>
<div class="dv">{{productData.PerCholesterol}}%</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">Sodium
<div class="weight">{{productData.Sodium}}mg</div>
</div>
<div class="dv">{{productData.PerSodium}}%</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">Total Carbohydrates
<div class="weight">{{productData.Carbs}}g</div>
</div>
<div class="dv">{{productData.PerCarbs}}%</div>
</div>
</td>
</tr>
<tr>
<td class="indent">
<div class="line">
<div class="labellight">Dietary Fiber
<div class="weight">{{productData.Fiber}}g</div>
</div>
<div class="dv">{{productData.PerFiber}}%</div>
</div>
</td>
</tr>
<tr>
<td class="indent">
<div class="line">
<div class="labellight">Sugars
<div class="weight">{{productData.Sugars}}g</div>
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="label">
Protein
<div class="weight">{{productData.Protein}}g</div>
</div>
</div>
</td>
</tr>
<tr style="height: 7px">
<td style="background-color: #000000;"></td>
</tr>
<tr>
<td>
<table cellspacing="0" cellpadding="0" border="0" class="vitamins">
<tbody>
<tr>
<td>Vitamin A {{productData.VitA}}%</td>
<td style="text-align: center;">•</td>
<td>Vitamin C {{productData.VitC}}%</td>
</tr>
<tr>
<td>Calcium {{productData.Calc}}%</td>
<td style="text-align: center;">•</td>
<td>Iron {{productData.Iron}}%</td>
</tr>
<tr>
<td>Vitamin D {{productData.VitD}}%</td>
<td style="text-align: center;">•</td>
<td>Vitamin E {{productData.VitE}}%</td>
</tr>
<tr>
<td>Thiamine {{productData.Thia}}%</td>
<td style="text-align: center;">•</td>
<td>Riboflavin {{productData.Ribo}}%</td>
</tr>
<tr>
<td>Niacin {{productData.Niac}}%</td>
<td style="text-align: center;">•</td>
<td>Vitamin B6 {{productData.VitB6}}%</td>
</tr>
<tr>
<td>Folate {{productData.Folate}}%</td>
<td style="text-align: center;">•</td>
<td>Vitamin B12 {{productData.VitB12}}%</td>
</tr>
<tr>
<td>Biotin {{productData.Biotin}}%</td>
<td style="text-align: center;">•</td>
<td>Phosphorus {{productData.Phos}}%</td>
</tr>
<tr>
<td>Zinc {{productData.Zinc}}%</td>
<td style="text-align: center;">•</td>
<td>Magnesium {{productData.Mag}}%</td>
</tr>
<tr>
<td>Iodine {{productData.Iodine}}%</td>
<td style="text-align: center;">•</td>
<td>Copper {{productData.Copper}}%</td>
</tr>
<tr>
<td>Pantothenic Acid {{productData.Acid}}%</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<div class="line">
<div class="labellight">
*Percent Daily Values are based on a 2000 calories diet. Your daily values may be higher or lower depending on your calories needs.
<table border=0 width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="30%"> </td>
<td width="30%">Calories:</td>
<td width="20%" style="text-align:left">2000</td>
<td width="20%" style="text-align:left">2000</td>
</tr>
</table>
</div>
</div>
<div class="line labellight" style="width: 100%;">
<table border=0 cellspacing="0" cellpadding="0" style="width: 100%">
<tr>
<td width="30%">Total Fat</td>
<td width="30%">Less Than</td>
<td width="20%" style="text-align:left">65<i>g</i></td>
<td width="20%" style="text-align:left">80<i>g</i></td>
</tr>
<tr>
<td width="30%">Sat Fat</td>
<td width="30%">Less Than</td>
<td width="20%" style="text-align:left">20<i>g</i></td>
<td width="20%" style="text-align:left">25<i>g</i></td>
</tr>
<tr>
<td width="30%">Cholesterol</td>
<td width="30%">Less Than</td>
<td width="20%" style="text-align:left">300<i>mg</i></td>
<td width="20%" style="text-align:left">300<i>mg</i></td>
</tr>
<tr>
<td>Sodium</td>
<td>Less Than</td>
<td style="text-align:left">2400<i>mg</i></td>
<td style="text-align:left">2400<i>mg</i></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td colspan="2">Total Carbohydrates</td>
<td style="text-align:left">300<i>g</i></td>
<td style="text-align:left">375<i>g</i></td>
</tr>
<tr>
<td colspan="2"> Dietary Fiber</td>
<td style="text-align:left">25<i>g</i></td>
<td style="text-align:left">30<i>g</i></td>
</tr>
</table>
<div class="line">
Calories per gram:
<br />
Fat 9 - Carbohydrate 4 - Percent 4
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="print()">Print</button>
<button class="btn btn-primary" type="button" ng-click="close()">Close</button>
</div>
The problem is the table content requires more then the div width.
A very simple fix to start with is using the overflow CSS property in the #nutritionfacts div.
#nutritionfacts {
border: 1px solid black;
padding: 3px;
font-family: 'Arial Black', sans-serif;
overflow: scroll;
}
As for the modal border-radius problem, you need to override the default .modal-content class which in bootstrap styles has a border-raidius: 6px rule.

Add Horizontal Scroll in Jquery Mobile Table?

I have the following markup,
<table class="ui-responsive table-stroke ui-table ui-table-columntoggle"
data-mode="columntoggle" data-role="table" style=
"overflow-x: scroll !important;">
<thead>
<tr>
<th class="ui-table-priority-6" data-colstart="1"
data-priority="6" style="font-weight: bold;">SL</th>
<th class="ui-table-priority-6" data-colstart="2"
data-priority="6" style="font-weight: bold;">Cat</th>
<th class="ui-table-priority-6" data-colstart="3"
data-priority="6" style="font-weight: bold;">Brand</th>
<th class="ui-table-priority-6" data-colstart="4"
data-priority="6" style="font-weight: bold;">Product</th>
<th class="ui-table-priority-persist" data-colstart="5"
data-priority="persist" style="font-weight: bold;">Item
Code</th>
<th class="ui-table-priority-persist" data-colstart="6"
data-priority="persist" style="font-weight: bold;">Model
Number</th>
<th class="ui-table-priority-6" data-colstart="7"
data-priority="6" style="font-weight: bold;">Bundle Value</th>
<th class="ui-table-priority-persist" data-colstart="8"
data-priority="persist" style="font-weight: bold;">Old RSP</th>
<th class="ui-table-priority-persist" data-colstart="9"
data-priority="persist" style="font-weight: bold;">Promo
RSP</th>
<th class="ui-table-priority-6" data-colstart="10"
data-priority="6" style="font-weight: bold;">Reduced %age</th>
<th class="ui-table-priority-6" data-colstart="11"
data-priority="6" style="font-weight: bold;">Start Date</th>
<th class="ui-table-priority-6" data-colstart="12"
data-priority="6" style="font-weight: bold;">Vendor End
Date</th>
</tr>
</thead>
<tbody>
<tr>
<td class="ui-table-priority-6">
<p>A115</p>
</td>
<td class="ui-table-priority-6">
<p>SDA</p>
</td>
<td class="ui-table-priority-6">
<p>Panasonic</p>
</td>
<td class="ui-table-priority-6">
<p>Blender</p>
</td>
<td class="ui-table-priority-persist">
<p>11651099</p>
</td>
<td class="ui-table-priority-persist">
<p>MXAC400</p>
</td>
<td class="ui-table-priority-6">
<p>GV 50</p>
</td>
<td class="ui-table-priority-persist">
<p><strong> 399</strong></p>
</td>
<td class="ui-table-priority-persist">
<p>
<strong> 399</strong></p>
</td>
<td class="ui-table-priority-6">
<p>0%</p>
</td>
<td class="ui-table-priority-6">
<p>Feb 26th</p>
</td>
<td class="ui-table-priority-6">
<p>Mar 8th</p>
</td>
</tr>
<tr>
<td class="ui-table-priority-6">
<p>C073</p>
</td>
<td class="ui-table-priority-6">
<p>SDA</p>
</td>
<td class="ui-table-priority-6">
<p>Tefal</p>
</td>
<td class="ui-table-priority-6">
<p>Fryer</p>
</td>
<td class="ui-table-priority-persist">
<p>11480473</p>
</td>
<td class="ui-table-priority-persist">
<p>FZ700072</p>
</td>
<td class="ui-table-priority-6">
<p>PB</p>
</td>
<td class="ui-table-priority-persist">
<p><strong>999</strong></p>
</td>
<td class="ui-table-priority-persist">
<p><strong> 749</strong></p>
</td>
<td class="ui-table-priority-6">
<p>25%</p>
</td>
<td class="ui-table-priority-6">
<p>Mar 1st</p>
</td>
<td class="ui-table-priority-6">
<p>Will Revert</p>
</td>
</tr>
</tbody>
</table>
Can I add a horizontal markup? So that users can easily scroll right and left
You can wrap your table with div like:
<div style="width: 100%; height: 400px; overflow: auto">
<table>
<!-- table content -->
</table>
</div>
If table > window width scroll will be visible dy default.
Check CSS styles and js (jQuery Mobile can fixed the table to window width)
Also you can use div container, for example:
<div style="width:300px;overflow:auto">
<table>...</table>
</div>
The answers above worked for me; however, I didn't want to specify explicit widths or heights, so the following solved the problem even better:
<div style="overflow-x: auto;">
<table [...] </table>
</div>

Categories