Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getReservationList() {
- $.ajax({
- cache: false,
- url: wcfServiceUrl + "GetReservations",
- data: "{}",
- type: "GET",
- contentType: "application/javascript",
- dataType: "jsonp",
- error: function (errorDetails) {
- alert("GetReservations error!");
- console.log(errorDetails);
- },
- success: function (data) {
- if (data != null) {
- var deserializedData = JSON.parse(data.DataResponse);
- console.log(deserializedData);
- reservationList = deserializedData;
- }
- else {
- console.log(data.message);
- alert(data.Message);
- }
- }
- });
- };
- ____________________________________________________________________________________
- var reservationList;
- $(document).ready(function () {
- getReservationList();
- console.log(reservationList);
- var coachHTML = "";
- var sortedCoaches = new Object();
- for (var i = 0; i < tableData.length; i++) {
- sortedCoaches[tableData[i].Coach] = new Array();
- }
- for (var i = 0; i < tableData.length; i++) {
- sortedCoaches[tableData[i].Coach].push(tableData[i]);
- }
- console.log(sortedCoaches);
- var coachList = Object.keys(sortedCoaches);
- console.log(coachList);
- for (var i = 0; i < coachList.length; i++) {
- coachHTML += "<div data-role='collapsible'><h3><div style='float:left'>Coach " + coachList[i] + "</div><div style='float: right'>" + sortedCoaches[coachList[i]].length + " " + "Seats Taken" + "</div></h3><p>";
- coachHTML += "<table class='reservationsTableCSS'>" +
- "<thead >" +
- "<tr class='ui-bar-b schedule_row '>" +
- "<th>Coach</th>" +
- "<th>Seat</th>" +
- "<th>Class</th>" +
- "<th>Leg</th>" +
- "<th>Notes</th>" +
- "</tr>" +
- "</thead>" +
- "<tbody>";
- for (var s = 0; s < sortedCoaches[coachList[i]].length; s++) {
- coachHTML += "<tr id='tablerow'>" +
- "<td> " + sortedCoaches[coachList[i]][s].Coach + "</td>" +
- "<td> " + sortedCoaches[coachList[i]][s].Seat + "</td>" +
- "<td> " + sortedCoaches[coachList[i]][s].Class + "</td>" +
- "<td> " + sortedCoaches[coachList[i]][s].Leg + "</td>" +
- "<td> " + sortedCoaches[coachList[i]][s].Notes + "</td>";
- coachHTML += "</tr>";
- }
- coachHTML += "</tbody></table></p></div>";
- }
- $(".reservationstable").html(coachHTML);
- $(".reservationstable").collapsibleset("refresh");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement