Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
Last active December 25, 2015 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timelyportfolio/7026976 to your computer and use it in GitHub Desktop.
Save timelyportfolio/7026976 to your computer and use it in GitHub Desktop.
<script>
jQuery.fn.dataTableExt.oSort['string_ignore_null-asc'] = function(x,y) {
if (x == null && y == null) return ((x < y) ? 1 : ((x > y) ? -1 : 0));
if (x == null) return 1;
if (y == null) return -1;
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['string_ignore_null-desc'] = function(x,y) {
if (x == null && y == null) return ((x < y) ? 1 : ((x > y) ? -1 : 0));
if (x == null) return 1;
if (y == null) return -1;
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
</script>
<script type="text/javascript" charset="utf-8">
var chartParams{{{ chartId }}} = {{{ chartParams }}}
$('#' + chartParams{{{ chartId }}}.id).removeClass("rChart")
$(document).ready(function() {
drawDataTable(chartParams{{{ chartId }}})
});
function drawDataTable(chartParams){
var dTable = $('#' + chartParams.dom).dataTable(
chartParams.table
);
//first use rCharts width
$('#'+chartParams.id+"_wrapper").css("width",chartParams.width)
$('#'+chartParams.id+"_wrapper").css("width",chartParams.table.width)
//then if specified change to table width
$('#'+chartParams.id+"_wrapper").css("margin-left", "auto");
$('#'+chartParams.id+"_wrapper").css("margin-right", "auto");
dTable.fnAdjustColumnSizing();
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment