jQuery Datatable filter hidden column by dropbox does not work - datatables

http://live.datatables.net/wifezuru/2/edit
15th column is hidden and value is false/true. When select (left top corner) shipping status from there it must filter DataTable by true/false value of the 15th column. Table works fine but that filter is not working. I mean does not show anything.
Also I tested with
$('#zctb').DataTable().columns(9).search('Sheridan-Sept2022').draw();
it works fine but
$('#zctb').DataTable().columns(15).search('true').draw()
; does not show result.
$("#zctb").DataTable({
"responsive": true,
"bAutoWidth": true,
scrollX: true,
// execute callback when DataTable is completely initialiazed
"initComplete": function () {
// Select the column whose header we need replaced using its index(0 based)
this.api().column(2).every(function () {
var column = this;
// Put the HTML of the <select /> filter along with any default options
var select = $('<select class="form-control input-sm"><option value="">All</option></select>')
// remove all content from this column's header and
// append the above <select /> element HTML code into it
.appendTo($(column.header()).empty())
// execute callback when an option is selected in our <select /> filter
.on('change', function () {
// escape special characters for DataTable to perform search
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
// Perform the search with the <select /> filter value and re-render the DataTable
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
// fill the <select /> filter with unique values from the column's data
column.data().unique().sort().each(function (d, j) {
select.append("<option value='" + d + "'>" + d + "</option>");
});
});
this.api().column(9).every(function () {
var column = this;
// Put the HTML of the <select /> filter along with any default options
var select = $('<select class="form-control input-sm"><option value="">All</option></select>')
// remove all content from this column's header and
// append the above <select /> element HTML code into it
.appendTo($(column.header()).empty())
// execute callback when an option is selected in our <select /> filter
.on('change', function () {
// escape special characters for DataTable to perform search
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
console.log('folder val ' + val);
// Perform the search with the <select /> filter value and re-render the DataTable
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
// fill the <select /> filter with unique values from the column's data
column.data().unique().sort().each(function (d, j) {
select.append("<option value='" + d + "'>" + d + "</option>");
});
});
// this.api().column(8).every(function () {
// var column = this;
// // Put the HTML of the <select /> filter along with any default options
// var select = $('<select class="form-control input-sm" id="bannedFilter" onchange="FilterBannedPeople(this)"><option value="">All</option> <option value="true">shipped</option> <option value="false">unshipped</option> </select>')
// // remove all content from this column's header and
// // append the above <select /> element HTML code into it
// .appendTo($(column.header()).empty())
// // execute callback when an option is selected in our <select /> filter
// .on('change', function () {
// // escape special characters for DataTable to perform search
// var val = $.fn.dataTable.util.escapeRegex(
// $(this).val()
// );
//
// // Perform the search with the <select /> filter value and re-render the DataTable
//
// column
// .search(val ? '^' + val + '$' : '', true, false)
// .draw();
// });
// // fill the <select /> filter with unique values from the column's data
// column.data().unique().sort().each(function (d, j) {
// select.append("<option value='" + d + "'>" + d + "</option>")
// });
// });
},
// disable sorting on the column with the filter in its header.
"columnDefs": [
{
"targets": 15,
//if searchable enabled, FilterBannedPeople won't work
//if searchable disabled, global search will search hidden column
"searchable": false
}
]
});
$.fn.dataTable.tables({visible: true, api: true}).columns.adjust();
$.fn.dataTable.ext.search.push(
function (settings, searchData, index, rowData, counter) {
var searchVal = $('#bannedFilter').val();
// Show all rows if select is emptry - 'all'
if (searchVal === '') {
return true;
}
// Show only rows that match the select value
if (searchVal === rowData[15]) {
return true;
}
// Filter row if it doesn't match.
return false;
}
);
function FilterBannedPeople(bannedFilterDropDown) {
var datatableObj = $('#zctb').DataTable();
var searchVal = $(bannedFilterDropDown).val();
var colIndex = 15;
console.log(datatableObj.columns(colIndex).search(searchVal).draw());
datatableObj.columns(colIndex).search(searchVal).draw();
}
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<div class="panel panel-default">
<select class="form-control input-sm" id="bannedFilter" onchange="FilterBannedPeople(this)">
<option value="">All</option>
<option value="true">shipped</option>
<option value="false">unshipped</option>
</select>
<div class="panel-body">
<div id="zctb_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer"><div class="row"><div class="col-sm-6"><div class="dataTables_length" id="zctb_length"><label>Show <select name="zctb_length" aria-controls="zctb" class="form-control input-sm"><option value="10">10</option><option value="25">25</option><option value="50">50</option><option value="100">100</option></select> entries</label></div></div><div class="col-sm-6"><div id="zctb_filter" class="dataTables_filter"><label>Search:<input type="search" class="form-control input-sm" placeholder="" aria-controls="zctb"></label></div></div></div><div class="row"><div class="col-sm-12"><div class="dataTables_scroll"><div class="dataTables_scrollHead" style="overflow: hidden; position: relative; border: 0px; width: 100%;"><div class="dataTables_scrollHeadInner" style="box-sizing: content-box; width: 1915px; padding-right: 0px;"><table class="display table table-striped table-bordered table-hover dataTable no-footer" cellspacing="0" width="100%" role="grid" style="margin-left: 0px; width: 1915px;"><thead>
<tr role="row"><th rowspan="1" colspan="1">#</th><th rowspan="1" colspan="1">Customer Name</th><th rowspan="1" colspan="1">User</th><th rowspan="1" colspan="1">Tiny URL</th><th rowspan="1" colspan="1">Full URL</th><th rowspan="1" colspan="1">SO</th><th rowspan="1" colspan="1">WO</th><th rowspan="1" colspan="1">PO</th><th rowspan="1" colspan="1">Shipped?</th><th rowspan="1" colspan="1">Folder</th><th rowspan="1" colspan="1">Scan Count</th><th rowspan="1" colspan="1">Download</th><th rowspan="1" colspan="1">QR Image</th><th rowspan="1" colspan="1">Created Date</th><th rowspan="1" colspan="1">Action</th><th rowspan="1" colspan="1">Action</th></tr>
<tr role="row"><td class="sorting_asc" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 0px;" aria-label=": activate to sort column descending" aria-sort="ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 39px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 200px;" aria-label=": activate to sort column ascending"><select class="form-control input-sm"><option value="">All</option><option value="hello1#gmail.com">hello1#gmail.com</option><option value="hello#gmail.com">hello#gmail.com</option></select></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 16px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 483px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 27px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 44px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 72px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 36px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 170px;" aria-label=": activate to sort column ascending"><select class="form-control input-sm"><option value="">All</option><option value="Office Resource-Boston">Office Resource-Boston</option><option value="Sheridan-Sept2022">Sheridan-Sept2022</option></select></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 15px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 40px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 78px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 32px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 19px;" aria-label=": activate to sort column ascending"></td><td class="sorting" tabindex="0" aria-controls="zctb" rowspan="1" colspan="1" style="width: 19px;" aria-label=": activate to sort column ascending"></td></tr>
</thead></table></div></div><div class="dataTables_scrollBody" style="position: relative; overflow: auto; width: 100%;"><table id="zctb" class="display table table-striped table-bordered table-hover dataTable no-footer" cellspacing="0" width="100%" role="grid" aria-describedby="zctb_info" style="width: 100%;"><thead>
<tr role="row" style="height: 0px;"><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 22px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">#</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 61px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Customer Name</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 222px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">User</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 38px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Tiny URL</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 505px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Full URL</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 49px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">SO</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 66px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">WO</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 94px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">PO</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 58px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Shipped?</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 192px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Folder</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 37px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Scan Count</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 62px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Download</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 100px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">QR Image</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 54px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Created Date</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 41px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Action</div></th><th rowspan="1" colspan="1" style="padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; width: 41px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Action</div></th></tr>
<tr role="row" style="height: 0px;"><td class="sorting_asc" aria-controls="zctb" rowspan="1" colspan="1" style="width: 0px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column descending" aria-sort="ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 39px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 200px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"><select class="form-control input-sm"><option value="">All</option><option value="hello1#gmail.com">hello1#gmail.com</option><option value="hello#gmail.com">hello#gmail.com</option></select></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 16px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 483px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 27px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 44px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 72px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 36px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 170px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"><select class="form-control input-sm"><option value="">All</option><option value="Office Resource-Boston">Office Resource-Boston</option><option value="Sheridan-Sept2022">Sheridan-Sept2022</option></select></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 15px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 40px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 78px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 32px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 19px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td><td class="sorting" aria-controls="zctb" rowspan="1" colspan="1" style="width: 19px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;" aria-label=": activate to sort column ascending"><div class="dataTables_sizing" style="height:0;overflow:hidden;"></div></td></tr>
</thead>
<tbody>
<tr role="row" class="odd">
<td class="sorting_1">1</td>
<td>Sheridan</td>
<td>hello#gmail.com</td>
<td>17aca</td>
<td>dropbox</td>
<td>SO4564</td>
<td>wo345435</td>
<td>po345345</td>
<td>
<input type="checkbox" disabled="" class="call-checkbox" checked="" value="1">
</td>
<td>Sheridan-Sept2022</td>
<td>7</td>
<!-- <td><a id="download" href="-->
<!--"-->
<!-- download="-->
<!--">Download</a></td>-->
<td><a id="download" href="qr_images/SO4564-21.png" download="SO4564-21.png">Download</a>
<br>
</td>
<td><img src="qr_images/SO4564-21.png" width="100"></td>
<td>2022-09-19 15:56:16</td>
<td>
<i class="fa fa-pencil"></i>
<i class="fa fa-trash" style="color:red"></i>
</td>
<td>
true </td>
</tr><tr role="row" class="even">
<td class="sorting_1">2</td>
<td>Franklin Labs</td>
<td>hello1#gmail.com</td>
<td>0f354</td>
<td>dropbox2</td>
<td>SO6237</td>
<td></td>
<td>117-254-417375198864</td>
<td>
<input type="checkbox" value="0" class="call-checkbox" onclick="checkboxchecked(21)">
</td>
<td>Office Resource-Boston</td>
<td>4</td>
<!-- <td><a id="download" href="-->
<!--"-->
<!-- download="-->
<!--">Download</a></td>-->
<td><a id="download" href="qr_images/SO6237-20.png" download="SO6237-20.png">Download</a>
<br>
</td>
<td><img src="qr_images/SO6237-20.png" width="100"></td>
<td>2022-09-12 10:41:56</td>
<td>
<i class="fa fa-pencil"></i>
<i class="fa fa-trash" style="color:red"></i>
</td>
<td>
false </td>
</tr></tbody>
</table></div></div></div></div><div class="row"><div class="col-sm-5"><div class="dataTables_info" id="zctb_info" role="status" aria-live="polite">Showing 1 to 2 of 2 entries</div></div><div class="col-sm-7"><div class="dataTables_paginate paging_simple_numbers" id="zctb_paginate"><ul class="pagination"><li class="paginate_button previous disabled" id="zctb_previous">Previous</li><li class="paginate_button active">1</li><li class="paginate_button next disabled" id="zctb_next">Next</li></ul></div></div></div></div>
</div>
</div>
</body>
</html>

Related

React Native HTMLToPDF printing awkward character

So I have this HTML template to transform to pdf using the RNHTMLToPDF package:
export default function getPdfTemplate(requestData, items, switchValues) {
return `
<div style="display: flex; flex-direction: column; width: 100%;">
<div id="pdf-header" style="display: flex; flex-direction: row; width: 100%;">
<div style="display: flex; flex-direction: column; width: 50%;">
<div style="font-size: 10px"> <b>Nome do cliente: </b> ${requestData.nomeCliente} </div>
<div style="font-size: 10px"> <b>Código do cliente: </b> ${
requestData.codigoCliente
} </div>
<div style="font-size: 10px"> <b>Número do pedido: </b> ${requestData.numPedido} </div>
<div style="font-size: 10px"> <b>Gerado em: </b> ${new Date().toLocaleDateString()} via Sistema de vendas </div>
</div>
<div style="display: flex; flex-direction: column; width: 50%;">
<div style="font-size: 10px"> <b>Data da negociação: </b> ${moment(
requestData.dataPedido,
"YYYYMMDD"
).format("DD/MM/YYYY")} - ${requestData.horaPedido} </div>
<div style="font-size: 10px"> <b>Quantidade de itens: ${
requestData.quantidadeItem
} </b> </div>
<div style="font-size: 10px"> <b>Valor total do pedido: </b> R$ ${
requestData.valorTotalPedido
} </div>
<div style="font-size: 10px"> <b>Valor do desconto negociado: </b> R$ ${
requestData.discount
} </div>
</div>
</div>
<hr style="margin: 14px 0 8px 0;">
<div id="pdf-table">
<h2 style="font-size: 10px; margin: 8px 0;">Lista de itens do pedido</h2>
<table style="background-color: #F3F3F4; width: 100%; border-collapse: collapse" >
<thead style="background-color: #656F7B;" >
<tr style="color: #FFF; font-size: 8px;" >
<th style="padding: 5px; font-size: 8px;">MERCADORIA</th>
<th style="padding: 5px; font-size: 8px;">QTDE</th>
<th style="padding: 5px; font-size: 8px;">COD BARRAS</th>
<th style="padding: 5px; font-size: 8px;">UNIT.LI+IMP</th>
<th style="padding: 5px; font-size: 8px;">TOL.LIQ+IMP</th>
<th style="padding: 5px; font-size: 8px;">COND PGTO</th>
<th style="padding: 5px; font-size: 8px;">VLR.FRETE</th>
<th style="padding: 5px; font-size: 8px;">FIL EXPED</th>
<th style="padding: 5px; font-size: 8px;">FIL FAT</th>
<th style="padding: 5px; font-size: 8px;">% DE ICMS</th>
</tr>
</thead>
<tbody>
${
items && items.length > 0 ? (
items.map(
(item, index) =>
`<tr style="line-height: 45px; background:${
index % 2 != 0 ? "#FFFFFF" : "initial"
}">
<td colspan="10" style="padding: 0px 10px; text-align:start; font-size: 8px;">${item.CODMER} - ${item.DESMER}</td>
<!--td colspan="9" style="font-size: 8px;"></td-->
</tr>
<tr style="margin: 4px 10px; line-height: 45px; background:${
index % 2 != 0 ? "#FFFFFF" : "initial"
}">
<td colspan="1" style="text-align:center; font-size: 6px;"> - </td>
<td colspan="1" style="text-align:center; font-size: 6px;">${
item.quantidadeMercadoria
}</td> <!-- qtd -->
<td colspan="1" style="text-align:center; font-size: 6px;">${
item.CODBRRMER
}</td> <!-- cód barras item -->
<td colspan="1" style="text-align:center; font-size: 6px;">
${(
item.VLRLIQMER +
item.VLRFRTMER +
item.stb.valorSTBTotal +
item.valorIPITotal
).toFixed(2)}
</td> <!-- Valor Unitário Líquido + Imposto + Frete -->
<td colspan="1" style="text-align:center; font-size: 6px;">
${(
(item.VLRLIQMER + item.VLRFRTMER) *
item.quantidadeMercadoria +
item.stb.valorSTBTotal +
item.valorIPITotal
).toFixed(2)}
</td> <!-- Total líquido + Imposto + Frete -->
<td colspan="1" style="text-align:center; font-size: 6px;">${
item.condicaoPagamento.codigoCondicaoPagamento
}</td> <!-- condição de pagamento -->
<td colspan="1" style="text-align:center; font-size: 6px;">${
switchValues.freightValue ? item.frete : ''
}</td> <!-- valor frete -->
<td colspan="1" style="text-align:center; font-size: 6px;">${
switchValues.exp ? item.CODFILEPD : ''
}</td> <!-- filial expedição -->
<td colspan="1" style="text-align:center; font-size: 6px;">${
switchValues.fat ? item.CODFILFAT : ''
}</td> <!-- filial faturamento -->
<td colspan="1" style="text-align:center; font-size: 6px;">
${
switchValues.icms
? item.mercadoria.percentualICMS
.percentualICMSMercadoria
: ''
}</td> <!-- percentual ICMS -->
</tr>`
)
) : null
}
</tbody>
</table>
</div>
<div id="pdf-footer">
<br>
<hr>
<h2 style="font-size: 10px;">Observações</h2>
<div style="border: 1px solid #9BA3A8; border-radius: 8px; margin: 8px 0; padding: 12px; font-size: 6px;">
** ATENÇÃO! As informações deste arquivo destinam-se a mera conferência da descrição, quantidade e valor (nesta data) dos itens pedidos, sendo certo que, até o faturamento da mercadoria, o pedido poderá sofrer alterações, seja pela falta de produto em estoque, por variações de alíquotas de ICMS, IPI, débitos do cliente perante o Fisco Estadual, entre outros motivos, razão pela qual este documento não vincula as partes.
</div>
<div style="border: 1px solid #9BA3A8; border-radius: 8px; margin: 8px 0; padding: 12px; font-size: 6px;">
** Informamos ainda, que o presente pedido encontra-se em aberto até a data do faturamento, pelo que V. Sa. poderá promover o cancelamento ou a inclusão de novos itens, o que poderá provocar a modificação dos percentuais de desconto, influenciando no preço final dos pedidos.
</div>
</div>
</div>
`
}
Printing this awkward comma character. I can't find it anywhere in the respective HTML
Any reason for this mystery?
Found the problem
Just had to add a join at the end of the map function item.map(el...).join('')

using v-for in vue js component

I need to dynamically add rows to my table, when I add some data in vue component. I am using v-for it must automatically add rows after adding data, but it doesn't show me anything, just a table header.
<table style="width: 95%;" cellspacing="0" id="main2">
<tbody>
<tr>
<th style="width: 55%; background-color: #343434; color: #FFFFFF; text-align: left; font-weight: normal; "><span class="target-field" data-path="name_word_output">Назва</span></th>
<th style="width: 15%; background-color: #343434; color: #FFFFFF; text-align: center; font-weight: normal;"><span class="target-field" data-path="quantity_word_output">Кількість</span></th>
<th style="width: 15%; background-color: #343434; color: #FFFFFF; text-align: center; font-weight: normal;"><span class="target-field" data-path="rate_word_output">Вартість</span></th>
<th style="width: 15%; background-color: #343434; color: #FFFFFF; text-align: center; font-weight: normal;"><span class="target-field" data-path="amount_word_output">Разом</span></th>
</tr>
<tr v-for="item in rowData">
<td style="border: 1px solid #ddd;"><span class="target-field" data-path="issue.name">{{item.tovarname}}</span></td>
<td style="border: 1px solid #ddd; text-align: center;"><span class="target-field" data-path="issue.quantity"></span> <span class="target-field" data-path="issue.unit">{{item.fakturahowmany}}</span></td>
<td style="border: 1px solid #ddd; text-align: center;"><span class="target-field" data-path="currency_type_output">₴</span> <span class="target-field" data-path="issue.price_per_one">{{item.fakturaprice}}</span></td>
<td style="border: 1px solid #ddd; text-align: center;"><span class="target-field" data-path="currency_type_output">₴</span> <span class="target-field" data-path="issue.amount">{{item.fakturahowmany*item.fakturaprice}}</span></td>
</tr>
</tbody>
</table>
and another part
methods: {
addItem(){
this.$root.totalprice+=this.$root.fakturahowmany*this.$root.fakturaprice;
var my_object = {
tovarname:this.$root.tovarname,
fakturahowmany:this.$root.fakturahowmany,
fakturaprice:this.$root.fakturaprice,
};
this.$root.rowData.push(my_object)
//
this.$root.tovarname = 1;
this.$root.fakturahowmany = 1;
this.$root.fakturaprice = 1;
}
}
}
How can I fix it? Thanks!
You have to start a unique key for the items through v-bind: key = "item.id" in your v-for
<tr v-for="item in rowData" v-bind:key="item.id" >
link: https://v2.vuejs.org/v2/guide/list.html#Maintaining-State

td center aligned without space, borders and padding

Problem
i've to do a little html email just for test. The problem is that right now i cannot reset all the space between this 5 tds.
I need them in the center of the table.
Tries
I already tried, as suggested in many posts:
border spacing
border collapse
reset all in css ( html, body, p etc )
display: inline-table
display: inline-block
This is only the interested row of a bigger table, the other rows works perfectly.
i don't know what i could try to fix this.
Expectation
five square near to each other in the center of the
Code
<table id="bodyTable" width="100%" bgcolor="#efefef" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto; font-family: Museo, Helvetica, Arial, sans-serif">
<tr>
<td>
<table align="center" border="0" cellspacing="0" cellpadding="0" style="max-width: 600px">
<tr>
<tr>
<td>
<table width="600px" border="0" cellspacing="0" cellpadding="0" bgcolor="#efefef">
<tr>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/y48sqQs/Goglueplus-Logo.png" alt="twitterButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px;" src="https://i.ibb.co/m5nZrrg/facebook-Mini-Button.png" alt="facebookButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/cxLcQcQ/Instagram-Logo.png" alt="googlePlusButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/rxT4vzx/Linkedin-Button.png" alt="linkedinButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/3FCYZ4z/twitter-Button.png" alt="instagramButton">
</td>
</tr>
</table>
</td>
</tr>
</tr>
</table>
</td>
</tr>
</table>
CSS RESET
body {
margin: 0;
padding: 0;
-webkit-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
-webkit-font-smoothing: antialiased !important;
}
img {
border: 0 none !important;
display: block;
height: auto;
line-height: 100%;
outline: none !important;
text-decoration: none;
}
a img {
border: 0 none;
}
table, td {
border-collapse: collapse;
border: 0 none;
}
td, a, span {
mso-line-height-rule: exactly;
}
p {
Margin: 0px !important;
Padding: 0px !important;
}
#bodyTable{
height: 100% !important;
margin: 0;
padding: 0;
width: 100% !important;
-webkit-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
-webkit-font-smoothing: antialiased !important;
}
In the Html, your table width is 600px. Try 300px for centering them.
body {
margin: 0;
padding: 0;
-webkit-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
-webkit-font-smoothing: antialiased !important;
}
img {
border: 0 none !important;
display: block;
height: auto;
line-height: 100%;
outline: none !important;
text-decoration: none;
}
a img {
border: 0 none;
}
table,
td {
border-collapse: collapse;
border: 0 none;
}
td,
a,
span {
mso-line-height-rule: exactly;
}
p {
Margin: 0px !important;
Padding: 0px !important;
}
#bodyTable {
height: 100% !important;
margin: 0;
padding: 0;
width: 100% !important;
-webkit-text-size-adjust: 100% !important;
-ms-text-size-adjust: 100% !important;
-webkit-font-smoothing: antialiased !important;
}
<table id="bodyTable" width="100%" bgcolor="#efefef" border="0" cellspacing="0" cellpadding="0" style="margin: 0 auto; font-family: Museo, Helvetica, Arial, sans-serif">
<tr>
<td>
<table align="center" border="0" cellspacing="0" cellpadding="0" style="max-width: 600px">
<tr>
<tr>
<td>
<table width="300px" border="0" cellspacing="0" cellpadding="0" bgcolor="#efefef">
<tr>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/y48sqQs/Goglueplus-Logo.png" alt="twitterButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px;" src="https://i.ibb.co/m5nZrrg/facebook-Mini-Button.png" alt="facebookButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/cxLcQcQ/Instagram-Logo.png" alt="googlePlusButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/rxT4vzx/Linkedin-Button.png" alt="linkedinButton">
</td>
<td align="center">
<img style="height: 30px; padding: 10px" src="https://i.ibb.co/3FCYZ4z/twitter-Button.png" alt="instagramButton">
</td>
</tr>
</table>
</td>
</tr>
</tr>
</table>

Custom (width and height) to print Product Labels on Odoo - QWEB

Right now the system is printing the Product Labels and work fine but in wrong dimensions.
I need set width to 7cm and height to 4cm on QWEB report.
Where I can change the dimensions to print QWEB report?
I can't change the format to the print preferences because in a sheet can be many Products Labels.
This is my QWEB:
<?xml version="1.0"?>
<t t-name="product.report_productlabel">
<t t-call="report.html_container">
<div class="page">
<style>
</style>
<t t-foreach="docs" t-as="template">
<t t-foreach="template.product_variant_ids" t-as="product">
<div class="col-xs-6" style="padding:0;">
<table style="border-spacing:0;margin-bottom:0;height: 110px;border: 2px solid black;" class="table">
<thead>
<tr style="width: 3in;">
<td style="width: 2.63in;text-align: center;background-color: #fff;" colspan="2" class="col-xs-8 danger">
<strong style="text-transform: uppercase;">
<t t-esc="product.name"/>
</strong>
</td>
</tr>
</thead>
<tbody>
<tr style="width: 1in;">
<td style="text-align: center; border-top: 0px solid #fff; padding: 0px 5px 0px 5px;" class="col-xs-5">
<h4 style="border: 4px solid #ff4040;border-radius: 9px;background-color: #ffff00;padding: 10px 12px 10px 12px;font-size: 26px;margin-top: 0px;margin-bottom: 0px;">
<strong t-field="product.list_price" />
<strong>
<t t-esc="product.company_id.currency_id.symbol"/>
</strong>
</h4>
</td>
<td style="text-align: center;border-top: 0px solid #fff;padding: 0px 5px 0px 5px;" class="col-xs-7">
<img class="img-responsive"
t-att-src="'data:image/png;base64,%s' % res_company.logo"
style="background-color: #fff;margin-left: auto;margin-right: auto;width: auto;height: 16px;margin-bottom: 8px;"/>
<img class="img-responsive" t-if="product.barcode"
t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', product.barcode, 650, 200)"
style="height: 20px;width: 100%;"/>
<span style="">
<t t-esc="product.barcode"/>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</div>
This the solution for the width of the table using the DPI of 90;
<table style="border-spacing:0;margin-bottom:0;height: 187px; width: 319px; border: 2px solid black;" class="table">
This is the QWEB template with the dimensions you need and I also scale the fonts and padding of the table elements to match the new width and height:
<?xml version="1.0"?>
<t t-name="product.report_productlabel">
<t t-call="report.html_container">
<div class="page">
<style>
</style>
<t t-foreach="docs" t-as="template">
<t t-foreach="template.product_variant_ids" t-as="product">
<div class="col-xs-6" style="padding:0;">
<table style="border-spacing:0;margin-bottom:0;height: 187px; width: 319px; border: 2px solid black;"
class="table">
<thead>
<tr style="width: 3in;">
<td style="width: 2.63in; font-size: 19px; text-align: left; background-color: #fff; margin-top: 10px;"
colspan="2"
class="col-xs-8 danger">
<strong style="text-transform: uppercase;">
<t t-esc="product.name"/>
</strong>
</td>
</tr>
</thead>
<tbody>
<tr style="width: 1in;">
<td width="50%"
style="text-align: center; border-top: 0px solid #fff; padding: 5px; position: relative;">
<div style="position:absolute; bottom: 20px; left: 0; padding-left: 5px; width: 100%">
<h4 style="border: 4px solid #ff4040; border-radius: 9px; background-color: #ffff00; padding: 10px 6px; font-size: 21px; margin: 0px ">
<strong t-field="product.list_price"/>
<strong>
<t t-esc="product.company_id.currency_id.symbol"/>
</strong>
</h4>
</div>
</td>
<td width="50%"
style="text-align: center;border-top: 0px solid #fff;padding: 5px; position: relative;">
<div style="position:absolute; bottom: 20px; padding-right: 5px;">
<img class="img-responsive"
t-att-src="'data:image/png;base64,%s' % res_company.logo"
style="background-color: #fff; margin-left: auto; margin-right: auto; width: auto; height: 35px; margin-bottom: 5px;"/>
<img class="img-responsive" t-if="product.barcode"
t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('EAN13', product.barcode, 650, 200)"
style="height: 20px; width: 100%;"/>
<span style="font-size: 14px">
<t t-esc="product.barcode"/>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</div>
</t>
You might look at the report.paperformat model, which defines the format for the paper size. You find the default values in addons\report\views\report_paperformat_views.xml.

How can i click a smart gwt check box using selenium RC java using xpath not with locators

Hi i'm automating a web page built with smart gwt controls . I recorded the clicking of the check box in a list grid using locators. I tried clicking through Xpath , it returns the response as ok but it wont click.
scLocator=//ListGrid[ID=\"isc_SideListGrid_0"\"]/body/row[1]/col[isCheckboxField=true||0]
Xpath:
selenium.click("//div//table[#id='isc_17table']//tbody/tr[1]/td[1]/div/nobr/img");
HtML Source of one row
<div id="isc_17" style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200450;CURSOR:default;" eventproxy="isc_SideListGrid_0_body">
<div style="position:relative;z-index:1000;">
<div id="isc_SideListGrid_0_body$28s" style="width:1px;height:0px;overflow:hidden;display:none;">
<table id="isc_17table" class="listTable" width="654" cellspacing="0" cellpadding="2" border="0" style="table-layout:fixed;overflow:hidden;wrap:false;padding-left:0px;padding-right:0px;" role="presentation">
<tbody></tbody>
<colgroup>
<tbody>
<tr role="listitem">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 28px; overflow: hidden;">
<div style="overflow: hidden; width: 24px;" cellclipdiv="true" role="presentation">
<nobr>
<img width="13" height="13" border="0" align="TEXTTOP" suppress="TRUE" style="vertical-align:middle;margin-left:2px;margin-right:2px;" eventpart="valueicon" src="http://localhost:8080/oatedge/reports/acceptanceReport/sc/skins/Enterprise/images/DynamicForm/checked.png">
</nobr>
</div>
</td>
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 80px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
<td class="tallCellSelected" height="" align="center" style="height: 22px; width: 91px; overflow: hidden;">
</tr>
</tbody>
</table>
<div id="isc_SideListGrid_0_body$284" style="width:1px;height:0px;overflow:hidden;display:none;">
</div>
<div onscroll="return isc_HLayout_5.$lh()" style="position: absolute; left: 558px; top: 3px; width: 100px; height: 22px; z-index: 200900; visibility: inherit; padding: 0px; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" class="normal" eventproxy="isc_HLayout_5" id="isc_30">
<div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200900;CURSOR:default;" eventproxy="isc_HLayout_5" id="isc_31"> <div onscroll="return isc_ImgButton_4.$lh()" style="position: absolute; left: 18px; top: 1px; width: 20px; height: 19px; z-index: 200918; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1764" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_4,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_4,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_4" id="isc_33"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200918;CURSOR:pointer;" eventproxy="isc_ImgButton_4" id="isc_32"><img width="20" height="19" border="0" align="TEXTTOP" suppress="TRUE" name="isc_32main" src="http://localhost:8080/oatedge/reports/images/icon-delete-d.png"></div></div><div onscroll="return isc_ImgButton_3.$lh()" style="position: absolute; left: 41px; top: 1px; width: 20px; height: 19px; z-index: 200936; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1815" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_3,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_3,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_3" id="isc_35"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200936;CURSOR:pointer;" eventproxy="isc_ImgButton_3" id="isc_34"><img width="20" height="19" border="0" align="TEXTTOP" suppress="TRUE" name="isc_34main" src="http://localhost:8080/oatedge/reports/images/icon-accept-d.png"></div></div><div onscroll="return isc_ImgButton_5.$lh()" style="position: absolute; left: 64px; top: 0px; width: 18px; height: 15px; z-index: 200954; -moz-box-sizing: border-box; overflow: hidden;" tabindex="1866" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_5,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_5,true);" class="imgButton" role="button" eventproxy="isc_ImgButton_5" id="isc_37"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:200954;CURSOR:pointer;" eventproxy="isc_ImgButton_5" id="isc_36"><img width="18" height="15" border="0" align="TEXTTOP" suppress="TRUE" name="isc_36main" src="http://localhost:8080/oatedge/reports/images/icon-merge-d.png"></div></div></div></div>