Added no-sort options to tables

Added a no-sort class to column headers where sorting doesn’t make
sense.  Still have the attachments table in the templates page to do,
there was something strange happening.
pull/87/head
Justin Gray 2016-01-17 15:27:11 -06:00
parent 2ff2cbd1ca
commit b9fd654f8a
10 changed files with 39 additions and 14 deletions

View File

@ -95,7 +95,11 @@ $(document).ready(function(){
$("#loading").hide() $("#loading").hide()
if (campaigns.length > 0){ if (campaigns.length > 0){
$("#campaignTable").show() $("#campaignTable").show()
campaignTable = $("#campaignTable").DataTable(); campaignTable = $("#campaignTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
});
$.each(campaigns, function(i, campaign){ $.each(campaigns, function(i, campaign){
label = labels[campaign.status] || "label-default"; label = labels[campaign.status] || "label-default";
campaignTable.row.add([ campaignTable.row.add([
@ -131,7 +135,11 @@ $(document).ready(function(){
return false; return false;
}) })
// Create the group typeahead objects // Create the group typeahead objects
groupTable = $("#groupTable").DataTable() groupTable = $("#groupTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
})
group_bh = new Bloodhound({ group_bh = new Bloodhound({
datumTokenizer: function(g) { return Bloodhound.tokenizers.whitespace(g.name) }, datumTokenizer: function(g) { return Bloodhound.tokenizers.whitespace(g.name) },
queryTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace,

View File

@ -33,7 +33,11 @@ $(document).ready(function(){
showLabel: false showLabel: false
} }
var average = 0 var average = 0
campaignTable = $("#campaignTable").DataTable(); campaignTable = $("#campaignTable").DataTable({
columnDefs: [
{ 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";

View File

@ -92,7 +92,11 @@ function load(){
$("#loading").hide() $("#loading").hide()
if (pages.length > 0){ if (pages.length > 0){
$("#pagesTable").show() $("#pagesTable").show()
pagesTable = $("#pagesTable").DataTable(); pagesTable = $("#pagesTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
});
pagesTable.clear() pagesTable.clear()
$.each(pages, function(i, page){ $.each(pages, function(i, page){
pagesTable.row.add([ pagesTable.row.add([

View File

@ -178,7 +178,11 @@ function load(){
$("#loading").hide() $("#loading").hide()
if (templates.length > 0){ if (templates.length > 0){
$("#templateTable").show() $("#templateTable").show()
templateTable = $("#templateTable").DataTable(); templateTable = $("#templateTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
});
templateTable.clear() templateTable.clear()
$.each(templates, function(i, template){ $.each(templates, function(i, template){
templateTable.row.add([ templateTable.row.add([

View File

@ -53,8 +53,9 @@ function dismiss(){
function edit(idx){ function edit(idx){
targets = $("#targetsTable").dataTable({ targets = $("#targetsTable").dataTable({
destroy: true,// Destroy any other instantiated table - http://datatables.net/manual/tech-notes/3#destroy
columnDefs: [ columnDefs: [
{ orderable: false, targets: -1 } { orderable: false, targets: "no-sort" }
] ]
}) })
$("#modalSubmit").unbind('click').click(function(){save(idx)}) $("#modalSubmit").unbind('click').click(function(){save(idx)})
@ -123,7 +124,11 @@ function load(){
groups = gs groups = gs
$("#emptyMessage").hide() $("#emptyMessage").hide()
$("#groupTable").show() $("#groupTable").show()
groupTable = $("#groupTable").DataTable(); groupTable = $("#groupTable").DataTable({
columnDefs: [
{ orderable: false, targets: "no-sort" }
]
});
groupTable.clear(); groupTable.clear();
$.each(groups, function(i, group){ $.each(groups, function(i, group){
var targets = "" var targets = ""

View File

@ -47,7 +47,7 @@
<th>Name</th> <th>Name</th>
<th>Created Date</th> <th>Created Date</th>
<th>Status</th> <th>Status</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -113,7 +113,7 @@
<table id="groupTable" class="table table-hover table-striped table-condensed"> <table id="groupTable" class="table table-hover table-striped table-condensed">
<thead> <thead>
<th>Group Name</th> <th>Group Name</th>
<th></th> <th class="no-sort"></th>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>

View File

@ -67,7 +67,7 @@
<th>Name</th> <th>Name</th>
<th>Created Date</th> <th>Created Date</th>
<th>Status</th> <th>Status</th>
<th class="col-md-2 col-sm-2"></th> <th class="col-md-2 col-sm-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -44,7 +44,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Last Modified Date</th> <th>Last Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -46,7 +46,7 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Modified Date</th> <th>Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -47,7 +47,7 @@
<th>Name</th> <th>Name</th>
<th>Members</th> <th>Members</th>
<th>Modified Date</th> <th>Modified Date</th>
<th class="col-md-2"></th> <th class="col-md-2 no-sort"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -101,7 +101,7 @@
<th>Last Name</th> <th>Last Name</th>
<th>Email</th> <th>Email</th>
<th>Position</th> <th>Position</th>
<th></th> <th class="no-sort"></th>
<tbody> <tbody>
</tbody> </tbody>
</table> </table>