Bonjour,
je cherche à trier un tableau selon une date min et une date max. Mon problème est que je n'arrive pas à sélectionner toute les valeurs de mon tableau.
jquery
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 $('#dtp').change(function(){ $.each ($('#logs'), function(){ var min = $('#dtp1Input').val(); var max = $('#dtp2Input').val(); var current = $(this).text(); var dateMin = min.substring(6,10) + min.substring(3,5) + min.substring(0,2) + min.substring(14,16) + min.substring(17,19); var dateMax = max.substring(6,10) + max.substring(3,5) + max.substring(0,2) + max.substring(14,16) + max.substring(17,19); var dateCurrent = current.substring(6,10) + current.substring(3,5) + current.substring(0,2) + current.substring(12,14) + current.substring(15,17); if (dateMax < dateMin) { alert('Vos dates sont incorrectes'); }else if (dateMin <= dateCurrent && dateCurrent <= dateMax){ table.search($(this).val()).draw(); } else { } }); });
jade
Merci d'avance !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 div#filter(class="col-md-4") h3 Period table#dtp thead tr th(class="title_filter") Start th div#dtp1(class="input-group input-append date form_datetime") input#dtp1Input(size="16", type="text", value="01/01/1970 00:00", readonly, class="form-control") span(class="input-group-addon add-on") i(class="glyphicon glyphicon-time") tbody tr th(class="title_filter") End th div#dtp2(class="input-group input-append date form_datetime") input#dtp2Input(size="16", type="text", value="31/12/2999 23:59", readonly, class="form-control") span(class="input-group-addon") i(class="glyphicon glyphicon-time") form#filter(class="col-md-4") h3 Default file div(class= "input-group champ_search") p DVR.log input#newFile(type="file", name="newFile") li.plugin-grister h2 Logs table#logs(class="display", cellspacing="0", width="100%") thead tr th <b>#{strings.time}</b> th <b>#{strings.type}</b> th <b>#{strings.content}</b> th <b>#{strings.source}</b> th <b>#{strings.system}</b> tbody each key in keys tr td#dateTime #{globals.logs[key].date} td #{globals.logs[key].titre} td #{globals.logs[key].libele} td #{globals.logs[key].data1} td #{globals.logs[key].typeError}
Partager