Add sortDisabled check to buildHeaders function (issue #541 fix)

When sorting is disabled for a table header it removes sorting but still brings some issues described in #541 ('click' bindings are gone).