Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bce97bb
Merge remote-tracking branch 'timwis/master'
Jan 9, 2016
0b5665b
Merge branch '123-exclude-columns-from-table'
Jan 9, 2016
3a3083f
potential fix for #104
Jan 9, 2016
d157102
remove logging related to #104
Jan 9, 2016
b203f4c
WIP first pass at hiding full/total (unfiltered) dataset
Jan 18, 2016
5798e00
#150 for toggle base collection (for bar charts only)
Jan 18, 2016
220ecbc
#150 add the "zoom" way
Jan 18, 2016
d9c6a95
Merge remote-tracking branch 'timwis/master'
Jan 18, 2016
0e175ea
#151 show % of filter in balloon of bar chart
Jan 18, 2016
4f9b469
#66 first pass at adding tooltips
Jan 18, 2016
4fcbddc
#66 add check for blank description
Jan 18, 2016
bf0112b
#152 allow support of "IS NOT" and "IS"
Jan 18, 2016
6a8094b
change min period to days instead of months
Jan 19, 2016
c3298b9
Merge pull request #2 from marks/zoom-to-filtered-data
marks Jan 19, 2016
f7cd54e
Merge pull request #3 from marks/66-add-field-desc-to-tabe
marks Jan 19, 2016
8e7a4f8
header cosmetics
Jan 19, 2016
cfd66f2
#150 add zoom functionality to datetime
Jan 19, 2016
6e895fb
Merge pull request #4 from marks/zoom-to-filtered-data
marks Jan 19, 2016
b7294a4
Merge pull request #5 from marks/151-percent-in-balloon
marks Jan 20, 2016
2b19061
buggy and feature incomplete expand option
Jan 20, 2016
cf14c39
#151 fix bug I introduced when working on this feature
Jan 20, 2016
26221a1
Merge pull request #6 from marks/151-percent-in-balloon
marks Jan 20, 2016
1b2b940
more work on expanding and contracting cards
Jan 22, 2016
22f73af
tweaks for expand a card functionality
Jan 22, 2016
487b6a7
Merge remote-tracking branch 'timwis/master'
Jan 23, 2016
84148ed
update to vizwit master
Jan 23, 2016
e240a82
Merge pull request #7 from marks/master
marks Jan 23, 2016
fa9a1c2
#165 allow gist to be passed to editor
Jan 24, 2016
416a77a
Merge pull request #8 from marks/156-load-gist-to-editor
marks Jan 24, 2016
8d67a74
Merge remote-tracking branch 'timwis/master' into dev
Jan 24, 2016
26fa1a0
#168 this seems to fix it :D
Feb 9, 2016
3f4f927
move vizwit branding info to bottom
Feb 9, 2016
63c48d8
first pass at #173
Apr 9, 2016
1985807
Merge branch 'dev' into 173-record-details
Apr 10, 2016
5636220
Merge pull request #9 from marks/dev
marks Apr 10, 2016
563235c
Merge pull request #10 from marks/152-support-null-queries
marks Apr 10, 2016
ef0881c
#173 work
Apr 11, 2016
0e134af
#173 added rowDetails option to expand row and see details
Apr 11, 2016
581234f
merging with dev
Apr 11, 2016
790a985
Revert "merging with dev"
Apr 19, 2016
5293126
Merge remote-tracking branch 'timwis/master' into 173-rowDetails
Apr 29, 2016
ccf99f9
#173 take @timwis suggestion of using a template for the row details …
Apr 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/data/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@
"chartType": "table",
"provider": "socrata",
"domain": "data.cityofchicago.org",
"dataset": "xqx5-8hwx"
"dataset": "xqx5-8hwx",
"rowDetails": true
}
}
]
Expand Down
14 changes: 14 additions & 0 deletions src/scripts/templates/row-details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div class="table-responsive">
<table class="table row-detail">
<thead><tr><th style="width: 15%">Attribute</th><th>Value</th></tr></thead>
<tbody>
<% for(var key in data.columnLookup) { %>
<tr><td><%= data.columnLookup[key] %></td><td>
<% if(typeof(data.rowData[key]) != "undefined") { %>
<%= data.rowData[key] %>
<% } %>
</td></tr>
<% } %>
</tbody>
</table>
</div>
47 changes: 47 additions & 0 deletions src/scripts/views/table.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var _ = require('underscore')
var $ = require('jquery')
var Card = require('./card')
var LoaderOn = require('../util/loader').on
var LoaderOff = require('../util/loader').off
Expand Down Expand Up @@ -26,6 +27,20 @@ var addDescriptionToTitle = function (column) {
return column
}

var rowDetails = function (rowData, columns) {
// create columnLookup so we get column names and tooltips
var columnLookup = {}
_.each(columns, function (column) {
if (column.data != null) {
columnLookup[column.data] = column.title || column.data
}
})

var RowDetailsTemplate = require('../templates/row-details.html')
var templateMarkup = RowDetailsTemplate({columnLookup: columnLookup, rowData: rowData})
return templateMarkup
}

module.exports = Card.extend({
initialize: function (options) {
Card.prototype.initialize.apply(this, arguments)
Expand Down Expand Up @@ -56,6 +71,16 @@ module.exports = Card.extend({

columns = columns.map(addDescriptionToTitle)

if (this.config.rowDetails) {
// Add row detail control column
columns.unshift({
class: 'row-detail-control fa fa-plus-square-o',
orderable: false,
data: null,
defaultContent: ''
})
}

// Initialize the table
var container = this.$('.card-content table')
this.table = container.DataTable({
Expand All @@ -66,6 +91,28 @@ module.exports = Card.extend({
ajax: _.bind(this.dataTablesAjax, this)
})

if (this.config.rowDetails) {
// store this.table as table, which is used in the following callback
var table = this.table
// listen for row detail icon click and act apropriately
container.on('click', 'tr td.row-detail-control', function () {
var clicked = $(this)
var tr = clicked.closest('tr')
var row = table.row(tr)
if (row.child.isShown()) {
clicked.removeClass('fa-minus-square-o')
clicked.addClass('fa-plus-square-o')
tr.removeClass('details')
row.child.hide()
} else {
clicked.addClass('fa-minus-square-o')
clicked.removeClass('fa-plus-square-o')
tr.addClass('details')
row.child(rowDetails(row.data(), columns)).show()
}
})
}

this.activateTooltips(container)
}, this))
}
Expand Down
9 changes: 9 additions & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ body {
white-space: nowrap;
}

.card-content .dataTables_scrollBody table thead .row-detail-control {
visibility: hidden;
}

.card-content table.row-detail{
margin-left: 40px;
width: inherit;
}

/*.callout .card-content {
min-height: 0;
}*/
Expand Down