Skip to content
Permalink
Browse files

[IMP]web: Few cosmetic changes and document string added

  • Loading branch information...
msh-odoo committed Mar 20, 2019
1 parent dd98385 commit d4b501ee06b88c2bec3342c0f043eb72aa06c853
@@ -565,9 +565,7 @@ ListRenderer.include({
*/
_renderOptionalCell: function ($cells) {
if (!this.addTrashIcon) {
$cells.push($("<td/>", {
class: 'o-data-cell',
}));
$cells.push($("<td/>"));
}
},
/**
@@ -790,6 +788,12 @@ ListRenderer.include({
// Handlers
//--------------------------------------------------------------------------

/**
* override this method to unselect row before optional column added to listview
*
* @override
* @private
*/
_onAddColumn: function (ev) {
var _super = this._super.bind(this);
this.unselectRow().then(function () {
@@ -171,6 +171,12 @@ var ListRenderer = BasicRenderer.extend({
};
}
},
/**
* This method computes non optional columns i.e. columns which are going to display
* in list view
*
* @private
*/
_computeColumns: function () {
var self = this;
return _.filter(this.allColumns, function (col) {
@@ -179,6 +185,12 @@ var ListRenderer = BasicRenderer.extend({
|| _.contains(self.optionalColumnsEnabled, col.attrs.name)
});
},
/**
* This method computes optional columns i.e. columns which displayed
* inside optional dropdown in list view header
*
* @private
*/
_computeOptionalColumns: function () {
return _.filter(this.allColumns, function (col) {
return (col.attrs.optional && !!JSON.parse(col.attrs.optional))
@@ -450,7 +462,7 @@ var ListRenderer = BasicRenderer.extend({
if (this.hasSelectors) {
$cells.unshift($('<td>'));
}
if (this.optionalColumns) {
if (this.optionalColumns && this.optionalColumns.length) {
this._renderOptionalCell($cells);
}
return $('<tfoot>').append($('<tr>').append($cells));
@@ -655,9 +667,7 @@ var ListRenderer = BasicRenderer.extend({
* @private
*/
_renderOptionalCell: function ($cells) {
$cells.push($("<td/>", {
class: 'o-data-cell',
}));
$cells.push($("<td/>"));
},
/**
* Render a row, corresponding to a record.
@@ -671,7 +681,7 @@ var ListRenderer = BasicRenderer.extend({
var $cells = this.columns.map(function (node, index) {
return self._renderBodyCell(record, node, index, { mode: 'readonly' });
});
if (this.optionalColumns) {
if (this.optionalColumns && this.optionalColumns.length) {
this._renderOptionalCell($cells);
}

0 comments on commit d4b501e

Please sign in to comment.
You can’t perform that action at this time.