from unfold.plugin import Plugin
-class QueryTable (Plugin):
+class QueryGrid (Plugin):
"""A plugin for displaying a query as a list
if self.checkboxes:
# we use aoColumnDefs rather than aoColumns -- ignore user-provided aoColumns
if 'aoColumns' in self.datatables_options:
- print 'WARNING: querytable uses aoColumnDefs, your aoColumns spec. is discarded'
+ print 'WARNING: querygrid uses aoColumnDefs, your aoColumns spec. is discarded'
del self.datatables_options['aoColumns']
# set aoColumnDefs in datatables_options - might already have stuff in there
aoColumnDefs = self.datatables_options.setdefault ('aoColumnDefs',[])
# here 'checkbox' is the class that we give to the <th> dom elem
- # dom-checkbox is a sorting type that we define in querytable.js
+ # dom-checkbox is a sorting type that we define in querygrid.js
aoColumnDefs.append ( {'aTargets': ['checkbox'], 'sSortDataType': 'dom-checkbox' } )
def template_file (self):
- return "querytable.html"
+ return "querygrid.html"
def template_env (self, request):
env={}
# "js/dataTables.js", "js/dataTables.bootstrap.js", "js/with-datatables.js",
"js/manifold.js", "js/manifold-query.js",
"js/unfold-helper.js",
- # querytable.js needs to be loaded after dataTables.js as it extends
+ # querygrid.js needs to be loaded after dataTables.js as it extends
# dataTableExt.afnSortData
- "js/querytable.js",
+ "js/querygrid.js",
] ,
'css_files': [
# "css/dataTables.bootstrap.css",
# hopefully temporary, when/if datatables supports sPaginationType=bootstrap3
# for now we use full_numbers, with our own ad hoc css
# "css/dataTables.full_numbers.css",
- "css/querytable.css" ,
+ "css/querygrid.css" ,
"http://mleibman.github.io/SlickGrid/slick.grid.css",
# "http://mleibman.github.io/SlickGrid/css/smoothness/jquery-ui-1.8.16.custom.css",
# "http://mleibman.github.io/SlickGrid/examples/examples.css",
/* the bottom of the datatable needs more space */
-div.querytable-spacer { padding: 8px 4px 15px 4px; }
+div.querygrid-spacer { padding: 8px 4px 15px 4px; }
/* use same height as the googlemap plugin for nicer effect */
-div.querytable {
+div.querygrid {
width: 100%;
height: 600px;
}
/* this is crucial for slickgrid and bootstrap3 to play together nicely
https://github.com/mleibman/SlickGrid/issues/742
*/
-div.querytable div {
+div.querygrid div {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
-div.querytable .slick-column-name {
+div.querygrid .slick-column-name {
font-weight: bold;
font-size: medium;
padding: 5px;
}
-div.querytable {
+div.querygrid {
font-size: small;
}
/* an example of the css classes used */
-.querytable-column-network_hrn {
+.querygrid-column-network_hrn {
background-color:red;
}
var debug_deep=false;
// debug_deep=true;
- var QueryTable = Plugin.extend({
+ var QueryGrid = Plugin.extend({
init: function(options, element) {
this._super(options, element);
var keys = manifold.metadata.get_key(this.method);
this.key = (keys && keys.length == 1) ? keys[0] : null;
}
- if (! this.key) messages.warning("querytable.init could not kind valid key");
+ if (! this.key) messages.warning("querygrid.init could not kind valid key");
- if (debug) messages.debug("querytable: key="+this.key);
+ if (debug) messages.debug("querygrid: key="+this.key);
/* Setup query and record handlers */
this.listen_query(options.query_uuid);
for (c in all_columns) {
var column=all_columns[c];
this.slick_columns.push ( {id:column, name:column, field:column,
- cssClass: "querytable-column-"+column,
+ cssClass: "querygrid-column-"+column,
width:100, minWidth:40, });
}
var checkbox_selector = new Slick.CheckboxSelectColumn({
},
show_column: function(field) {
- console.log ("querytable.show_column not yet implemented with slickgrid - field="+field);
+ console.log ("querygrid.show_column not yet implemented with slickgrid - field="+field);
},
hide_column: function(field) {
- console.log("querytable.hide_column not implemented with slickgrid - field="+field);
+ console.log("querygrid.hide_column not implemented with slickgrid - field="+field);
},
/*************************** QUERY HANDLER ****************************/
},
on_field_clear: function() {
- alert('QueryTable::clear_fields() not implemented');
+ alert('QueryGrid::clear_fields() not implemented');
},
/* XXX TODO: make this generic a plugin has to subscribe to a set of Queries to avoid duplicated code ! */
},
on_all_field_clear: function() {
- alert('QueryTable::clear_fields() not implemented');
+ alert('QueryGrid::clear_fields() not implemented');
},
if (id === undefined) {
- messages.warning("querytable._set_checkbox record has no id to figure which line to tick");
+ messages.warning("querygrid._set_checkbox record has no id to figure which line to tick");
return;
}
var index = this.slick_dataview.getIdxById(id);
},
// the callback for when user clicks
- _checkbox_clicked: function(querytable,input,key) {
+ _checkbox_clicked: function(querygrid,input,key) {
// XXX this.value = key of object to be added... what about multiple keys ?
- if (debug) messages.debug("querytable click handler checked=" + input.checked + " key=" + key);
- manifold.raise_event(querytable.options.query_uuid, input.checked?SET_ADD:SET_REMOVED, key);
+ if (debug) messages.debug("querygrid click handler checked=" + input.checked + " key=" + key);
+ manifold.raise_event(querygrid.options.query_uuid, input.checked?SET_ADD:SET_REMOVED, key);
//return false; // prevent checkbox to be checked, waiting response from manifold plugin api
},
// xxx from this and down, probably needs further tweaks for slickgrid
- _querytable_filter: function(oSettings, aData, iDataIndex) {
+ _querygrid_filter: function(oSettings, aData, iDataIndex) {
var ret = true;
$.each (this.filters, function(index, filter) {
/* XXX How to manage checkbox ? */
_selectAll: function() {
// requires jQuery id
var uuid=this.id.split("-");
- var oTable=$("#querytable-"+uuid[1]).dataTable();
- // Function available in QueryTable 1.9.x
+ var oTable=$("#querygrid-"+uuid[1]).dataTable();
+ // Function available in QueryGrid 1.9.x
// Filter : displayed data only
var filterData = oTable._('tr', {"filter":"applied"});
/* TODO: WARNING if too many nodes selected, use filters to reduce nuber of nodes */
});
- $.plugin('QueryTable', QueryTable);
+ $.plugin('QueryGrid', QueryGrid);
// /* define the 'dom-checkbox' type for sorting in datatables
// http://datatables.net/examples/plug-ins/dom_sort.html
--- /dev/null
+<div id='spacer-{{ domid }}' class='querygrid-spacer'>
+<div class="querygrid" id="grid-{{ domid }}"></div>
+</div>
+++ /dev/null
-these styling elements come from plekit with a simple transition to png
-they're currently not all used in myslice
+++ /dev/null
-<div id='spacer-{{ domid }}' class='querytable-spacer'>
-<div class="querytable" id="grid-{{ domid }}"></div>
-</div>
-# just one instance of QueryTable, nothing more, nothing less
+# just one instance of QueryGrid, nothing more, nothing less
from django.views.generic.base import TemplateView
from django.template import RequestContext
from django.shortcuts import render_to_response
from ui.topmenu import topmenu_items, the_user
-from plugins.querytable import QueryTable
+from plugins.querygrid import QueryGrid
-class SimpleView (TemplateView):
+class SimpleGridView (TemplateView):
def get (self, request, slicename='ple.inria.f14'):
'user.user_hrn',
#'application.measurement_point.counter'
)
- # for internal use in the querytable plugin;
+ # for internal use in the querygrid plugin;
# needs to be a unique column present for each returned record
main_query_key = 'hrn'
sq_resource = aq.subquery('resource')
- resources_as_list = QueryTable(
+ resources_as_list = QueryGrid(
page = page,
domid = 'resources-list',
title = 'List view',
from django.conf.urls import patterns, include, url
-import trash.simpleview
+import trash.simplegridview
urlpatterns = patterns('',
url(r'^tab/?$', 'trash.sampleviews.tab_view'),
(r'^scroll/?$', 'trash.sampleviews.scroll_view'),
(r'^plugin/?$', 'trash.pluginview.test_plugin_view'),
(r'^dashboard/?$', 'trash.dashboard.dashboard_view'),
- url(r'^simple/(?P<slicename>[\w\.]+)/?$', trash.simpleview.SimpleView.as_view()),
+ url(r'^simple/(?P<slicename>[\w\.]+)/?$', trash.simplegridview.SimpleGridView.as_view()),
)