From bdc9cfb6884838fa88d60470247db542516e7498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= <cmartin@opennebula.org> Date: Fri, 12 Jun 2015 18:34:34 +0200 Subject: [PATCH] Feature #3748: Create a generic Dom DataTable --- .../dom-datatable.js} | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) rename src/sunstone/public/app/{tabs/oneflow-services-tab/panels/roles/roles-datatable.js => utils/dom-datatable.js} (52%) diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roles-datatable.js b/src/sunstone/public/app/utils/dom-datatable.js similarity index 52% rename from src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roles-datatable.js rename to src/sunstone/public/app/utils/dom-datatable.js index 9ae4fb5be1..05c9552a25 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/panels/roles/roles-datatable.js +++ b/src/sunstone/public/app/utils/dom-datatable.js @@ -11,43 +11,32 @@ define(function(require) { CONSTRUCTOR */ + /** + * Generic datatable that uses the columns and row data from the html dom, + * instead of .list and elementArray methods. Offers the same row check + * and row info mechanism as TabDataTable + * @param {string} dataTableId dataTable ID + * @param {object} conf Same as tab-datatable.js, plus: + * - dataTableOptions: replaces the default dataTableOptions + */ function Table(dataTableId, conf) { this.conf = conf || {}; - //this.tabId = TAB_NAME; this.dataTableId = dataTableId; - //this.resource = RESOURCE; - //this.xmlRoot = XML_ROOT; - // TODO: hide checkbox column - - - this.dataTableOptions = { + this.dataTableOptions = conf.dataTableOptions || { "bAutoWidth": false, "bSortClasses" : false, "bDeferRender": true, "aoColumnDefs": [ - {"bSortable": false, "aTargets": ["check"]}, - //{"bVisible": false, "aTargets": [0]} - //{"bVisible": true, "aTargets": [1,2,3,4,5]}, - //{"bVisible": false, "aTargets": ['_all']} + {"bSortable": false, "aTargets": ["check"]} ] }; - //this.columns = []; - //this.selectOptions = {}; - TabDataTable.call(this); } Table.prototype = Object.create(TabDataTable.prototype); Table.prototype.constructor = Table; - //Table.prototype.elementArray = _elementArray; return Table; - - /* - FUNCTION DEFINITIONS - */ - - //function _elementArray(element_json) {} });