Skip to content

Commit

Permalink
updated datatables and fixed sorting as stated in #27
Browse files Browse the repository at this point in the history
  • Loading branch information
TimRepke committed Oct 17, 2015
1 parent 457b68f commit a069c32
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 172 deletions.
40 changes: 24 additions & 16 deletions registration-system/admin/pages_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
$headers =<<<END
<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.1.10.9.min.js"></script>
END;
$headers .= "
<style type='text/css'>
Expand Down Expand Up @@ -242,28 +242,24 @@
}
$text .= "<br />";

$text .=<<<END
$text .= '
<table id="mlist" class="compact hover">
<thead>
<tr>
END;
foreach($columnFunctions as $key => $value)
{
<tr>';
foreach($columnFunctions as $key => $value) {
$text .= "<th>".$key."</th>";
}
$text .=<<<END
</tr>
$text .="<th></th></tr>
</thead>
<tbody>
END;
<tbody>";

$people = $admin_db->select('bachelor',$columns, array("fahrt_id"=>$config_current_fahrt_id));
foreach($people as $person) {
$text .= "<tr>"; //".((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? "" : "class='list-backstepped'")."
$text .= "<tr>\n"; //".((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? "" : "class='list-backstepped'")."
foreach($columnFunctions as $key => $value) {
$text .= "<td class='".$key.((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? '' :
' list-backstepped')."'>".$value($person)."</td>";
$text .= "<td class='".$key."'>".$value($person)."</td>\n";
}
$text .= "<td>".((explode(',',$columnFunctions['PaidReBack']($person))[2]==0) ? '0' : '1')."</td>";
$text .= "</tr>";
}

Expand All @@ -284,13 +280,11 @@
,
"prb-pre": function ( a ){
var tmp = a.split(",");
//alert();
return ((tmp[0]==0) ? '0' : '1') + ((tmp[1]==0) ? '0' : '1') + ((tmp[2]==0) ? '0' : '1');
}
,
"dedate-pre": function(a){
var tmp = a.split(".");
console.log(tmp[2]+tmp[1]+tmp[0]);
if(tmp.length>2)
return (tmp[2]+tmp[1]+tmp[0]);
return a;
Expand All @@ -299,6 +293,13 @@
var ltab;
$(document).ready(function(){
ltab = $('#mlist').DataTable({
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var tmp = aData[$buttoncol].split(',');
if (tmp[2] > 0) {
$('td',nRow).addClass('list-backstepped');
}
return nRow;
},
"aoColumnDefs": [
{
"aTargets": [ $buttoncol ],
Expand Down Expand Up @@ -327,9 +328,11 @@
},
{ type: 'dedate', targets: [1,5,6]},
{ type: 'link', targets: [0, 2] },
{ type: 'prb', targets: $buttoncol }
{ type: 'prb', targets: $buttoncol },
{ targets: 12, visible: false, searchable: false },
],
"order": [[ 2, "asc" ]],
"orderFixed": [ 12, 'asc' ],
"paging": false
});
Expand Down Expand Up @@ -362,6 +365,11 @@ function btnclick(that, type, hash, state){
var newstate = (((state-1)<0) ? 1 : 0);
$.get("index.php?page=list&ajax=ajax&update="+type+"&hash="+hash+"&nstate="+newstate ,"",
function(){
if(newstate === 1) {
$('td',$(that).parent().parent()).addClass('list-backstepped');
} else {
$('td',$(that).parent().parent()).removeClass('list-backstepped');
}
that.className="btn btn-"+type+"-"+newstate;
that.setAttribute("onclick", "btnclick(this, '"+type+"', '"+hash+"', "+newstate+")");
});
Expand Down
2 changes: 1 addition & 1 deletion registration-system/admin/pages_wl.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
$headers =<<<END
<link rel="stylesheet" type="text/css" href="../view/css/DataTables/css/jquery.dataTables.min.css" />
<script type="text/javascript" src="../view/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../view/js/jquery.dataTables.1.10.9.min.js"></script>
END;

$text .= "<h1>Warteliste</h1>";
Expand Down
Loading

0 comments on commit a069c32

Please sign in to comment.