text-align: left;
padding: 8px 12px 4px 20px;
vertical-align:middle;
- background: #CAE8EA url(../img/tablesort-header.jpg) no-repeat;
+/* background: #CAE8EA url(../img/tablesort-header.jpg) no-repeat; */
}
div.Hazelnut table.dataTable td, div.Hazelnut table.dataTable textarea, div.Hazelnut table.dataTable input [type="text"] {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
+/* one could think or using repeat-x here but that's not working because of the arrows
+ * we might need to make these wider some day */
div.Hazelnut table.dataTable thead .sorting { background: url('../img/tablesort-header-sortable.png') no-repeat; }
div.Hazelnut table.dataTable thead .sorting_asc { background: url('../img/tablesort-header-up.png') no-repeat; }
div.Hazelnut table.dataTable thead .sorting_desc { background: url('../img/tablesort-header-down.png') no-repeat; }
-/* former set did not have that exact equivalent - using an approximation for now */
-div.Hazelnut table.dataTable thead .sorting_asc_disabled { background: url('../img/tablesort-header-sortable.png') no-repeat; }
-div.Hazelnut table.dataTable thead .sorting_desc_disabled { background: url('../img/tablesort-header-sortable.png') no-repeat; }
+/* this icons set does not have that exact equivalent - using an approximation for now */
+div.Hazelnut table.dataTable thead .sorting_asc_disabled { background: url('../img/tablesort-header.png') no-repeat; }
+div.Hazelnut table.dataTable thead .sorting_desc_disabled { background: url('../img/tablesort-header.png') no-repeat; }
+
+/* the footers are not active */
+div.Hazelnut table.dataTable tfoot { background: url('../img/tablesort-header.png') no-repeat; }
+/* and when sorting is turned off it's useful to set this on header too */
+div.Hazelnut table.dataTable thead { background: url('../img/tablesort-header.png') no-repeat; }
var object = this;
/* Transforms the table into DataTable, and keep a pointer to it */
- this.table = $('#hazelnut-' + options.plugin_uuid).dataTable({
+ actual_options = {
// Customize the position of Datatables elements (length,filter,button,...)
- // inspired from :
// http://datatables.net/release-datatables/examples/advanced_init/dom_toolbar.html
// http://www.datatables.net/forums/discussion/3914/adding-buttons-to-header-or-footer/p1
- //"sDom": 'lf<"#datatableSelectAll-'+ options.plugin_uuid+'">rtip',
sDom: "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
sPaginationType: 'bootstrap',
// Handle the null values & the error : Datatables warning Requested unknown parameter
// http://datatables.net/forums/discussion/5331/datatables-warning-...-requested-unknown-parameter/p2
aoColumnDefs: [{sDefaultContent: '',aTargets: [ '_all' ]}],
-// bRetrieve: true,
// WARNING: this one causes tables in a 'tabs' that are not exposed at the time this is run to show up empty
// sScrollX: '100%', /* Horizontal scrolling */
bProcessing: true, /* Loading */
-// this looks like just another ugly hack
-// fnRowCallback: function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
-// $(nRow).attr('id', unfold.get_value(aData[3]));
-// return nRow;
-// },
fnDrawCallback: function() { hazelnut_draw_callback.call(object, options); }
- });
+ };
+ // the intention here is that options.datatables_options as coming from the python object take precedence
+ $.extend(actual_options, options.datatables_options );
+ this.table = $('#hazelnut-' + options.plugin_uuid).dataTable(actual_options);
/* Setup the SelectAll button in the dataTable header */
var oSelectAll = $('#datatableSelectAll-'+ options.plugin_uuid);
# set checkboxes if a final column with checkboxes is desired
# pass columns as the initial set of columns
# if None then this is taken from the query's fields
- def __init__ (self, query, checkboxes=False, columns=None, **settings):
+ def __init__ (self, query, checkboxes=False, columns=None, datatables_options={}, **settings):
Plugin.__init__ (self, **settings)
self.query=query
self.checkboxes=checkboxes
self.columns=columns
else:
self.columns=self.query.fields
+ self.datatables_options=datatables_options
def template_file (self):
return "hazelnut.html"
return reqs
# the list of things passed to the js plugin
- def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes']
+ def json_settings_list (self): return ['plugin_uuid','query_uuid','checkboxes','datatables_options']
checkboxes=True,
# this is the query at the core of the slice list
query=main_query,
+ # this of course should be automatic in hazelnut
+ # for now we turn off sorting on the checkboxes columns this way
+ datatables_options = { 'aoColumns' : [ None, None, None, None, {'bSortable': False} ] },
),
]),
Hazelnut (