[imp] nivified list view
bzr revid: nicolas.vanhoren@openerp.com-20110914143028-bwjnpw8vbubjc90k
This commit is contained in:
parent
f460118f42
commit
4e033738d0
|
@ -10,20 +10,19 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||||
* view should be displayed (if there is one active).
|
* view should be displayed (if there is one active).
|
||||||
*/
|
*/
|
||||||
searchable: false,
|
searchable: false,
|
||||||
template: "FormView",
|
template: "EmptyComponent",
|
||||||
/**
|
/**
|
||||||
* @constructs openerp.web.FormView
|
* @constructs openerp.web.FormView
|
||||||
* @extends openerp.web.View
|
* @extends openerp.web.View
|
||||||
*
|
*
|
||||||
* @param {openerp.web.Session} session the current openerp session
|
* @param {openerp.web.Session} session the current openerp session
|
||||||
* @param {String} element_id this view's root element id
|
|
||||||
* @param {openerp.web.DataSet} dataset the dataset this view will work with
|
* @param {openerp.web.DataSet} dataset the dataset this view will work with
|
||||||
* @param {String} view_id the identifier of the OpenERP view object
|
* @param {String} view_id the identifier of the OpenERP view object
|
||||||
*
|
*
|
||||||
* @property {openerp.web.Registry} registry=openerp.web.form.widgets widgets registry for this form view instance
|
* @property {openerp.web.Registry} registry=openerp.web.form.widgets widgets registry for this form view instance
|
||||||
*/
|
*/
|
||||||
init: function(parent, element_id, dataset, view_id, options) {
|
init: function(parent, dataset, view_id, options) {
|
||||||
this._super(parent, element_id);
|
this._super(parent);
|
||||||
this.set_default_options(options);
|
this.set_default_options(options);
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
this.model = dataset.model;
|
this.model = dataset.model;
|
||||||
|
@ -45,6 +44,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||||
_.defaults(this.options, {"always_show_new_button": true});
|
_.defaults(this.options, {"always_show_new_button": true});
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
|
this._super();
|
||||||
if (this.embedded_view) {
|
if (this.embedded_view) {
|
||||||
var def = $.Deferred().then(this.on_loaded);
|
var def = $.Deferred().then(this.on_loaded);
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -75,7 +75,7 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||||
this.fields_view = data;
|
this.fields_view = data;
|
||||||
var frame = new (this.registry.get_object('frame'))(this, this.fields_view.arch);
|
var frame = new (this.registry.get_object('frame'))(this, this.fields_view.arch);
|
||||||
|
|
||||||
this.$element.html(QWeb.render(this.template, { 'frame': frame, 'view': this }));
|
this.$element.html(QWeb.render("FormView", { 'frame': frame, 'view': this }));
|
||||||
_.each(this.widgets, function(w) {
|
_.each(this.widgets, function(w) {
|
||||||
w.start();
|
w.start();
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ openerp.web.list = function (openerp) {
|
||||||
var QWeb = openerp.web.qweb;
|
var QWeb = openerp.web.qweb;
|
||||||
openerp.web.views.add('list', 'openerp.web.ListView');
|
openerp.web.views.add('list', 'openerp.web.ListView');
|
||||||
openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# */ {
|
openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# */ {
|
||||||
|
template: "EmptyComponent",
|
||||||
defaults: {
|
defaults: {
|
||||||
// records can be selected one by one
|
// records can be selected one by one
|
||||||
'selectable': true,
|
'selectable': true,
|
||||||
|
@ -31,7 +32,6 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
|
||||||
* @extends openerp.web.View
|
* @extends openerp.web.View
|
||||||
*
|
*
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
* @param element_id the id of the DOM elements this view should link itself to
|
|
||||||
* @param {openerp.web.DataSet} dataset the dataset the view should work with
|
* @param {openerp.web.DataSet} dataset the dataset the view should work with
|
||||||
* @param {String} view_id the listview's identifier, if any
|
* @param {String} view_id the listview's identifier, if any
|
||||||
* @param {Object} options A set of options used to configure the view
|
* @param {Object} options A set of options used to configure the view
|
||||||
|
@ -42,9 +42,9 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
|
||||||
* @param {Boolean} [options.sortable=true] is it possible to sort the table by clicking on column headers
|
* @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
|
* @param {Boolean} [options.reorderable=true] is it possible to reorder list rows
|
||||||
*/
|
*/
|
||||||
init: function(parent, element_id, dataset, view_id, options) {
|
init: function(parent, dataset, view_id, options) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super(parent, element_id);
|
this._super(parent);
|
||||||
this.set_default_options(_.extend({}, this.defaults, options || {}));
|
this.set_default_options(_.extend({}, this.defaults, options || {}));
|
||||||
this.dataset = dataset;
|
this.dataset = dataset;
|
||||||
this.model = dataset.model;
|
this.model = dataset.model;
|
||||||
|
@ -128,6 +128,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
|
||||||
* @returns {$.Deferred} loading promise
|
* @returns {$.Deferred} loading promise
|
||||||
*/
|
*/
|
||||||
start: function() {
|
start: function() {
|
||||||
|
this._super();
|
||||||
this.$element.addClass('oe-listview');
|
this.$element.addClass('oe-listview');
|
||||||
return this.reload_view(null, null, true);
|
return this.reload_view(null, null, true);
|
||||||
},
|
},
|
||||||
|
|
|
@ -208,8 +208,7 @@ openerp.web.ViewManager = openerp.web.Widget.extend(/** @lends openerp.web.View
|
||||||
if (!view.controller) {
|
if (!view.controller) {
|
||||||
// Lazy loading of views
|
// Lazy loading of views
|
||||||
var controllerclass = this.registry.get_object(view_type);
|
var controllerclass = this.registry.get_object(view_type);
|
||||||
var controller = new controllerclass(this, this.element_id + '_view_' + view_type,
|
var controller = new controllerclass(this, this.dataset, view.view_id, view.options);
|
||||||
this.dataset, view.view_id, view.options);
|
|
||||||
if (view.embedded_view) {
|
if (view.embedded_view) {
|
||||||
controller.set_embedded_view(view.embedded_view);
|
controller.set_embedded_view(view.embedded_view);
|
||||||
}
|
}
|
||||||
|
@ -228,7 +227,8 @@ openerp.web.ViewManager = openerp.web.Widget.extend(/** @lends openerp.web.View
|
||||||
unique: true
|
unique: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
view_promise = controller.start();
|
var container = $("#" + this.element_id + '_view_' + view_type);
|
||||||
|
view_promise = controller.appendTo(container);
|
||||||
$.when(view_promise).then(function() {
|
$.when(view_promise).then(function() {
|
||||||
self.on_controller_inited(view_type, controller);
|
self.on_controller_inited(view_type, controller);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1422,4 +1422,7 @@
|
||||||
</t>
|
</t>
|
||||||
</ul>
|
</ul>
|
||||||
</t>
|
</t>
|
||||||
|
<t t-name="EmptyComponent">
|
||||||
|
<div></div>
|
||||||
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
|
Loading…
Reference in New Issue