콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
3187 화면

Hello everyone , I try to modify web.Pager in addon web, the code js as below

odoo.define('erpvn_web_branding.Pager'function (require) {
"use strict";

var core = require('web.core');
var config = require("web.config");

var Pager = require('web.Pager');

var _t = core._t;
var QWeb = core.qweb;

Pager.include({
    _renderfunction () {
        this._super.apply(thisarguments);
        if (this.state.size !== 0 && config.device.isMobile) {
            this.$value.html(Math.ceil(this.state.current_max / this.state.limit));
            this.$limit.html(Math.ceil(this.state.size / this.state.limit));
        }
    },
    _onEditfunction (event) {
        if (!config.device.isMobile) {
            this._super.apply(thisarguments);
        }
        event.stopPropagation();
    },
});

});

But when I run browse, I see this error in console

Please explain to me 
Thanks.

아바타
취소
베스트 답변

In version 14 Pager is an owl component it's not a standard widget.

아바타
취소
작성자

Thanks for your information, what sholud I do next

learn the owl framework :)

owl Component is basically javascript Class

So either monkey patch it to override the method or Find a clean way to extend it (if possible)

ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

베스트 답변

I think you can extend the pager in the same way that you have extended the DropdownMenuItem owl widget.

\https://github.com/odoo/odoo/blob/14.0/addons/web/static/src/js/control_panel/custom_filter_item.js#L45

아바타
취소
관련 게시물 답글 화면 활동
1
8월 25
1929
1
7월 25
2524
2
7월 25
7972
2
7월 25
4409
2
7월 25
4128