From 17be3b65996923644b6553dd88b5408894314e9d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 21 Apr 2011 14:06:08 +0200 Subject: [PATCH] [ADD] options for sortable and reorderable list views, so the API is pretty much complete bzr revid: xmo@openerp.com-20110421120608-vefcelpe5fxsz1op --- addons/base/static/src/js/list.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js index c60828732e8..04a97d902cf 100644 --- a/addons/base/static/src/js/list.js +++ b/addons/base/static/src/js/list.js @@ -10,7 +10,12 @@ openerp.base.ListView = openerp.base.Controller.extend( // whether the column headers should be displayed 'header': true, // display addition button, with that label - 'addable': "New" + 'addable': "New", + // whether the list view can be sorted, note that once a view has been + // sorted it can not be reordered anymore + 'sortable': true, + // whether the view rows can be reordered (via vertical drag & drop) + 'reorderable': true }, /** * Core class for list-type displays. @@ -33,6 +38,8 @@ openerp.base.ListView = openerp.base.Controller.extend( * @param {Boolean} [options.header=true] should the list's header be displayed * @param {Boolean} [options.deletable=true] are the list rows deletable * @param {null|String} [options.addable="New"] should the new-record button be displayed, and what should its label be. Use ``null`` to hide the button. + * @param {Boolean} [options.sortable=true] is it possible to sort the table by clicking on column headers + * @param {Boolean} [options.reorderable=true] is it possible to reorder list rows */ init: function(view_manager, session, element_id, dataset, view_id, options) { this._super(session, element_id); @@ -374,6 +381,8 @@ openerp.base.ListView = openerp.base.Controller.extend( return rows[$(this).prevAll().length].data.id.value; }).get(); } + // TODO: implement sort (click on column headers), if sorted, the list can not be reordered anymore + // TODO: implement reorder (drag and drop rows) }); openerp.base.TreeView = openerp.base.Controller.extend({