Added datatables sorting for dashboard campaigns. Fixes #166. Also formatting fixes.

pull/169/head
Jordan Wright 2016-02-18 18:42:00 -06:00
parent 3798896042
commit 77e38b6c72
1 changed files with 7 additions and 6 deletions

View File

@ -14,7 +14,7 @@ function deleteCampaign(idx) {
api.campaignId.delete(campaigns[idx].id) api.campaignId.delete(campaigns[idx].id)
.success(function(data) { .success(function(data) {
successFlash(data.message) successFlash(data.message)
location.reload() location.reload()
}) })
} }
} }
@ -51,12 +51,13 @@ $(document).ready(function() {
} }
var average = 0 var average = 0
campaignTable = $("#campaignTable").DataTable({ campaignTable = $("#campaignTable").DataTable({
columnDefs: [ columnDefs: [{
{ orderable: false, targets: "no-sort" } orderable: false,
] targets: "no-sort"
}); }]
});
$.each(campaigns, function(i, campaign) { $.each(campaigns, function(i, campaign) {
var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY h:mm:ss a') var campaign_date = moment(campaign.created_date).format('MMMM Do YYYY, h:mm:ss a')
var label = labels[campaign.status] || "label-default"; var label = labels[campaign.status] || "label-default";
// Add it to the table // Add it to the table
campaignTable.row.add([ campaignTable.row.add([