Skip to content

Commit

Permalink
Merge pull request #3 from marks/66-add-field-desc-to-tabe
Browse files Browse the repository at this point in the history
66 add field desc to table
  • Loading branch information
marks committed Jan 19, 2016
2 parents c3298b9 + 4fcbddc commit f7cd54e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/scripts/collections/socrata-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@ module.exports = Backbone.Collection.extend({
},
parse: function (response) {
return response.columns.map(function (row, key) {
var titleForRow = row.name
if(!_.isEmpty(row.description)){
titleForRow += ' <span class="fa fa-info-circle" data-toggle="tooltip" data-placement="top" title="'+row.description+'"></span>'
}
return {
data: row.fieldName,
title: row.name,
title: titleForRow,
type: this.typeMap[row.renderTypeName] || this.typeMap.default,
defaultContent: ''
defaultContent: '',
description: row.description
}
}, this)
}
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/views/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var LoaderOn = require('../util/loader').on
var LoaderOff = require('../util/loader').off
require('datatables')
require('datatables/media/js/dataTables.bootstrap')
require('bootstrap/js/tooltip')

module.exports = Card.extend({
initialize: function (options) {
Expand Down Expand Up @@ -99,6 +100,12 @@ module.exports = Card.extend({
}
})
}

// Initialize bootstrap-powered tooltips
jQuery('.dataTables_scrollHeadInner th span[data-toggle="tooltip"]').tooltip({
container : 'body'
});

},
// When another chart is filtered, filter this collection
onFilter: function (data) {
Expand Down

0 comments on commit f7cd54e

Please sign in to comment.