0
Ich bin mit jQuery DataTables- und ich möchte die Datentabelle mit Drop-Down-Liste filtern basierend aufDatentabellen-Filterung mit Dropdown-Liste
Gestern
Letzte 7 Tage
letzten 15 Tage
30 TageLast
Die Filterung soll wie folgt ist kein 3. Der Inhalt der Tabelle auf dem Staatszeitspalt dh Spalte basieren:
Host Name Severity State Time
localhost Warning 2017-02-10 10:19:38
localhost Warning 2017-02-18 15:59:24
localhost critical 2017-02-25 02:29:34
localhost critical 2017-02-27 15:57:24
localhost Warning 2017-02-27 09:20:15
localhost critical 2017-03-16 03:30:50
localhost ok 2017-03-17 09:20:35
localhost ok 2017-03-17 10:20:47
JS-Code:
criticalEventTableList1 = $('#example2').dataTable({
data: historyEventList.seriesCriticalEventList1,
"paging": false,
dom: 'Bfrtip',
buttons: [
'csv', 'excel'
],
"iDisplayLength": 10,
"bFilter": true,
"paging": true,
"responsive": true,
"createdRow": function(row, data, index ) {
if (data[2] == "1")
{
$('td', row).eq(2).css('background-color', '#FFC300','font-weight', 'bold');
$('td:eq(2)', row).html('<b>Warning</b>');
}
else if (data[2] == "2")
{
$('td', row).eq(2).css('background-color', '#F13B3B','font-weight', 'bold');
$('td:eq(2)', row).html('<b>Critical</b>');
}
},
});
HTML-Code:
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">Select
<span class="caret"></span></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
<li role="presentation"><a role="menuitem" tabindex="-1" id="" >Yesterdays</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" id="" >Last 7 Days</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" id="" >Last 15 Days</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" id="" >Last 1 Month</a></li>
</ul>
Sie müssen mindestens auf Ihre js Code für die Datentabelle zeigen. –
Hallo Arthur, ich habe meine Js-Code hinzugefügt – Gauravkb
@Gauravkb wie wäre es damit? https://jsbin.com/pahojutuse/edit?html,js,output – bassxzero