Here im using DataTable with Angular2 Here DataTable is working wen i refresh the page.But its not loading on 1st Run
<table datatable class="row-border hover">
<thead>
<tr>
<th>Auction ID</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let value of auction">
<td>{{value.name}}</td>
<tbody>
</table>
At The same time i used normal DataTable(Without *ngFor="") its working fine without any issue
<table datatable class="row-border hover">
<thead>
<tr>
<th>Auction ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<tbody>
</table>
Related
Anyone know how to use datatable with format table like this
table
My data table can't use with format table like that. My code for show data
<table id="table-rekap" class="table table-bordered">
<thead>
<tr>
<th class="text-center" style="width: 20%;">No</th>
<th class="text-center" style="width: 20%;">Unit Kerja</th>
<th>Jenis Kendaraan</th>
<th>Total</th>
</tr>
</thead>
#php $no = 1; #endphp
<tbody>
#foreach($rekapUnker as $unitKerja => $jenisKendaraan)
<tr>
<td class="text-center" rowspan="9">{{ $no++ }}</td>
<td class="text-center" rowspan="9">{{ $unitKerja }}</td>
#foreach($jenisKendaraan as $jenKen => $total)
<tr>
<td>{{ $jenKen }}</td>
<td>{{ $total }}</td>
</tr>
#endforeach
</tr>
#endforeach
</tbody>
</table>
Id table rekap for call data table
In my ASP.NET MVC Core app that uses Bootstrap (installed by default by Visual Studio 2015 MVC Core project), I need to use ID column in a controller but want to hide it in the View. But the following View still displays the column as blank. I would like to hide the first columns that is the ID column
View:
#model List<myProj.Models.StateName>
<form id="target" asp-controller="TestController" asp-action="TestAction" asp-route-returnurl="#ViewData[" ReturnUrl"]" method="post">
<table class="table">
<thead>
<tr>
<th></th>
<th>
State Name
</th>
<th>
State Code
</th>
</tr>
</thead>
<tbody>
#for (int i = 0; i < Model.Count(); i++)
{
<tr>
<td><input asp-for="#Model[i].StateId" type="hidden" /></td>
<td>
<label asp-for="#Model[i].State"></label>
</td>
<td>
<input asp-for="#Model[i].StateCode" type="text" readonly style="border:0px;"/>
</td>
</tr>
}
</tbody>
</table>
<button type="submit" class="btn btn-default">Save</button>
</form>
I've tested the behavior you describe in this pen. The "Bad Table" version demonstrates what I believe you are likely seeing and occurs by neglecting to add display:none to one single th/td in that column. The "Good Table" version has the first column completely hidden and stretches to fill the entire available width.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<h2>Good Table</h2>
<table class="table">
<thead>
<tr>
<th style="display:none">Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display:none">Data 1.1</td>
<td>Data 1.2</td>
<td>Data 1.3</td>
</tr>
<tr>
<td style="display:none">Data 2.1</td>
<td>Data 2.2</td>
<td>Data 2.3</td>
</tr>
<tr>
<td style="display:none">Data 3.1</td>
<td>Data 3.2</td>
<td>Data 3.3</td>
</tr>
</tbody>
</table>
<h2>Bad Table</h2>
<table class="table">
<thead>
<tr>
<th style="display:none">Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td style="display:none">Data 1.1</td>
<td>Data 1.2</td>
<td>Data 1.3</td>
</tr>
<tr>
<td>Data 2.1</td> <!-- WHOOPS -->
<td>Data 2.2</td>
<td>Data 2.3</td>
</tr>
<tr>
<td style="display:none">Data 3.1</td>
<td>Data 3.2</td>
<td>Data 3.3</td>
</tr>
</tbody>
</table>
Long and short, check the rendered output and ensure that each th/td in the column you are hiding ended up with the display:none style.
I have a database table that has a field in the row of which can have the same value. This is a "transaction id" field that will have the order number. The rows can have the same order number but different product id's for each item ordered.
I'm querying the database just fine and outputting the data as well. However, I want to separate the transaction id's that are the same and do something different with that data. I just can figure out how to do that for some reason.
example:
ID txn_id product_id Product_name field5
-------- --------- ----------- --------- ---------
1 265 98 Product Name
2 265 99 Product Name
3 244 98 Product Name
UPDATE
So here is my updated code that still needs help. I have two queries going now. One that checks for duplicates and places them into an array, then the other that loops through the database table with an if statement which checks for matching transaction id numbers.
First Query:
$myquery = $wpdb->get_results("SELECT txn_id , COUNT(*) FROM test_table HAVING COUNT(*) > 1");
global $TXN;
foreach($myquery as $query){
$TXN= $query->txn_id;
}
Then in the main query/loop
global $wpdb;
$prepare_query = $wpdb->get_results("SELECT * FROM test_table" );
foreach($prepare_query as $data){
$txn_id = $data->txn_id;
$product_id = $data->product_id;
$product_name = $data->product_name;
?>
<table class="shop_table my_account_orders" width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr class="order">
<td>
<?php echo "#" .$txn_id; ?>
<?php
if($txn_id === $TXN){
echo'YES';
}
?>
</td>
<td>
<?php echo $product_id; ?>
</td>
<td>
<?php echo $product_name; ?>
</td>
</tr>
</tbody>
</table>
<?php } ?>
This will output:
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>99</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#244</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
When what I want to get is:
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#265 YES</td>
<td>98</td>
<td>Product Name</td>
</tr>
<tr>
<td>#265 YES</td>
<td>99</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
<table width="100%">
<thead>
<tr>
<th align="left">Order #</th>
<th align="left">Product ID</th>
<th align="left">Product Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>#244</td>
<td>98</td>
<td>Product Name</td>
</tr>
</tbody>
</table>
To get the duplicated ids you could use:
SELECT id,txn_id , COUNT(*)
FROM table_name
HAVING COUNT(*) > 1
Replace of course table_name with the name of your table
I ended up doing it this way:
$myArray = $wpdb->get_results("SELECT * FROM " . $license_table);
$newArray=array();
foreach($myArray as $val){
$newKey=$val->txn_id;
$newArray[$newKey][]=$val;
}
print_r($newArray);
foreach ($newArray as $key => $array){
?>
<table border="0" cellpadding="0" cellspacing="0">
<tr class="header">
<td width="73%" valign="top">KEY</td>
<td width="73%" valign="top">Product Id</td>
<td width="27%" valign="top">Product Name</td>
</tr>
<?php
foreach($array as $values) {
?>
<tr class="details">
<td width="27%" valign="top"><?php echo $key; ?></td>
<td width="73%" valign="top"><?php echo $values->product_id; ?></td>
<td width="27%" valign="top"><?php echo $values->product_name ?></td>
</tr>
<?php } ?>
</table>
<?php
}
I'm trying to create a jQueryMobile compatible <table> with TYPO3.
It means adding data-role="table" and class="class="ui-responsive"".
This table can be generated with RTE or a Table Content Element.
RTE
Default <table> HTML
<table style="" class="contenttable">
<thead>
<tr>
<th scope="col">head 1</th>
<th scope="col">head 2</th>
<th scope="col">head 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>L 1</td>
<td>...</td>
<td>...</td>
</tr>
<tr>
<td>L 2</td>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
attempt to solve problem
I've added the following setup but jQuery seams not to work anymore. It load (spinning animation) indefinitely.
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.always = 1
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.data-role.default = table
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.default = ui-responsive
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list = ui-responsive
Content Element
Default <table> HTML
<table class="contenttable contenttable-0 test">
<thead>
<tr class="tr-even tr-0">
<th class="td-0" scope="col" id="col162967-0">head 1</th>
<th class="td-1" scope="col" id="col162967-1">head 2</th>
<th class="td-last td-2" scope="col" id="col162967-2">head 3</th>
</tr>
</thead>
<tbody>
<tr class="tr-odd tr-1">
<td class="td-0" headers="col162967-0">L 1</td>
<td class="td-1" headers="col162967-1">...</td>
<td class="td-last td-2" headers="col162967-2">...</td>
</tr>
<tr class="tr-even tr-last">
<td class="td-0" headers="col162967-0">L 2</td>
<td class="td-1" headers="col162967-1">...</td>
<td class="td-last td-2" headers="col162967-2">...</td>
</tr>
</tbody>
</table>
attempt to solve problem
I don't find in tt_content where to add configuration to add a classand data-role.
For the TABLE content element you have at least 2 options:
A. Render the table yourself - You can create your own PHP method that would do the processing of the tables. I presume you are using css_styled_content extension whose method render_table() does the rendering of the tables. You can copy that method, add it to your own class and modify it so that it adds the data-role attribute as you want.
B. Do some replacing of the outputted code - You can try to use the replacement property (available in TYPO3 >=4.6) of the stdWrap to replace class="contenttable with data-role="table" class="ui-responsive. I currently cannot test it but try this:
tt_content.table.20.stdWrap.replacement {
10 {
search = class="contenttable
replace = data-role="table" class="ui-responsive
}
}
There's a bug report open at forge to override the Flexform values via TSconfig TYPO3 forge.
The suggested workaround by overriding the flexform completly works fine though:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:'.$_EXTKEY.'/flexform_table.xml', 'table');
I'm using a jQuery UI sortable with a table (works fine). I would like to make the header and last row fixed (non-moveable).
The jQuery UI docs indicate this can be done using a selector for items, but I am at a loss for the syntax.
Here is the relevant code:
<script type="text/javascript">
$(function () {
$("#response_options tbody.content").sortable();
$("#response_options tbody.content").disableSelection();
});
</script>
<table id="response_options" class="data-table">
<tbody class="content">
<tr>
<th>Links</th><th>Response</th>
</tr>
<tr class="sortable-row">
<td>Edit</td>
<td>Item 1</td>
</tr>
<tr class="sortable-row">
<td>Edit</td>
<td>Item 2</td>
</tr>
<tr class="sortable-row">
<td>Edit</td>
<td>Item 3</td>
</tr>
<tr class="sortable-row">
<td>Edit</td>
<td>Item 4</td>
</tr>
<tr class="sortable-row">
<td>Edit</td>
<td>Item 5</td>
</tr>
<tr>
<td>Edit</td>
<td>Item 1</td>
</tr>
</tbody>
</table>
The selector goes inside .sortable(...):
$("#response_options tbody.content").sortable();
as
$("#response_options tbody.content").sortable( items: ??? );
and it should be possible to select only items with class="sortable-row"; but again, I am at a loss for the syntax.
This should work:
$("#response_options tbody.content").sortable({items: 'tr.sortable-row'});
This worked for me:
jQuery(".sortable tbody").sortable({
items: 'tr:not(:first)'
});
For this markup:
<table id="tableid">
<thead>
<tr>
<th>namr</th>
<th>id</th>
</tr>
</thead>
<tbody>
<tr>
<td>jagadeesh</td>
<td>1</td>
</tr>
<tr>
<td>jagadeesh</td>
<td>2</td>
</tr>
</tbody>
</table>
Use this jQuery:
$('#tableid tbody').sortable();
It will move only body content of table you cannot move header part.