@@ -123,12 +158,14 @@ for (var i = options.length - 1; i >= 0; i--) {
//This calls on the filter function, which by default displays ALL DEVICES! You can later filter by take out period!
populateDeviceList(null);
-//Test data
-$('div[data-num="1"]').click(fireCheck);
-$('input[data-num="1"]').click(selectBox);
+//Place event listeners on all device containers after they're displayed.
+$('div.deviceContainer').click(fireCheck);
+$('input.deviceCheckbox').click(selectBox);
$('#returnbutton').click(returnDevice);
$('#closeOrderForm').click(hidePopup);
+$(function(){$('#tabledisplay').DataTable();})
+
//This should make the device array of retrieved devices
function makeDeviceArray(){
window.json = '<%=deviceString%>';
@@ -172,12 +209,10 @@ function selectBox(){
var query2 = 'div[data-num="'+id+'"]';
var checked = $(query).prop('checked');
if(checked === false){
- $(query2).css("background-color","#E9EAEB");
- toReturn.splice(toReturn.indexOf(id),1)
+ $(query).prop('checked',true);
}
else{
- $(query2).css("background-color","#C2C3C4");
- toReturn.push(id);
+ $(query).prop('checked',false);
}
}
@@ -231,17 +266,15 @@ function populateDeviceList(filter)
var name = devicesToList[i].name;
var hardware = devicesToList[i].model;
var checkout = devicesToList[i].checkout;
- htmlString+="
";
}
if(i==0) htmlString+="Couldn't find any devices to return. Why not go order some?";
document.getElementById("devContainer").innerHTML = htmlString;
@@ -254,6 +287,11 @@ function populateDeviceList(filter)
function returnDevice()
{
+ var html = "";
+ for(var i = 0; i < toReturn.length; i++){
+ html+= "