Skip to content

Instantly share code, notes, and snippets.

@ashaw
Forked from esmooov/gist:604625
Created September 30, 2010 14:28
Show Gist options
  • Save ashaw/604663 to your computer and use it in GitHub Desktop.
Save ashaw/604663 to your computer and use it in GitHub Desktop.
TableFilterer.prototype.addClickHandler = function(el,facet,featuredness) {
tFinstance = this;
$(el).live('click',function() {
var entity = $(this).attr("data-"+facet);
var type = $(this).children('h4').html();
//for race "permalinks"
if (!_.isNaN(parseInt(entity))) {
entity = parseInt(entity);
};
$("#toolbar span").each(function() {
$(this).removeClass("selected");
});
$("#toolbar span[data-office_id=" + entity + "]").addClass("selected")
tFinstance.filterTableByall();
if (congro.unmagnified === false) {
console.log('magnified');
var current_magnified_state = congro.mag_state["0"].state_abbrev;
console.log(entity);
filterer.filterTableByMulti({'state_postal' : current_magnified_state, 'office_id' : entity});
} else {
tFinstance['filterTableBy' + facet](entity);
}
tFinstance.populateTable();
congro.colorStates(type);
congro.loadResults(type);
return false;
});
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment