İçereği Atla
Menü
Bu soru işaretlendi
3164 Görünümler

I want to override "_render: function ()" function from pivot_renderer.js file in web but not working in custom module. Here is the code i am implementing in my custom module:-

odoo.define('MY_CUSTOM_MODULE_NAME.renderer', function (require) {
"use strict";
var PivotRenderer = require('web.PivotRenderer');
var field_utils = require('web.field_utils');
var core = require('web.core');
var _t = core._t;
PivotRenderer.include({
init: function(parent, state, params) {
       this._super.apply(this, arguments);
    },
    _render: function () {
       if (!this._hasContent()) {
        // display the nocontent helper
        this.replaceElement(QWeb.render('PivotView.nodata'));
        return this._super.apply(this, arguments);
    }
    if (!this.$el.is('table')) {
        // coming from the no content helper, so the root element has to be
        // re-rendered before rendering and appending its content
        this.renderElement();
    }
    var $fragment = $(document.createDocumentFragment());
    var $table = $('').appendTo($fragment);
    var $thead = $('').appendTo($table).addClass("CLASS_NAME");
    var $tbody = $('').appendTo($table);
    var nbr_measures = this.state.measures.length;
    var nbrCols = (this.state.mainColWidth === 1) ?
        nbr_measures :
        (this.state.mainColWidth + 1) * nbr_measures;
    for (var i=0; i < nbrCols + 1; i++) {
        $table.prepend($(''));
    }
    this._renderHeaders($thead, this.state.headers);
    this._renderRows($tbody, this.state.rows);
    // todo: make sure the next line does something
    $table.find('.o_pivot_header_cell_opened,.o_pivot_header_cell_closed').tooltip();
    this.$el.html($table.contents());
    return this._super.apply(this, arguments);
},
});
});

In the above, i want to add a class in the header for calling my custom css "var $thead = $('').appendTo($table).addClass("CLASS_NAME");" with this syntax but it is not reflecting in my custom module. Although, for testing, I have implemented same class in default web module and it is working fine. The issue is in custom module.

So how to solve this issue? Is there any other way for calling class or i am doing it in a wrong way?


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Kas 22
3480
2
Ağu 22
7874
1
Oca 25
9554
1
Eyl 21
6855
1
Mar 21
5602