コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4015 ビュー

Here is my code to inherit ListRenderer but main function keeps working as it is and my super is not working, Here is my code

/** @odoo-module */

import { ListRenderer } from "@web/views/list/list_renderer";

const { useEffect } = owl;

export class NewListRenderer extends ListRenderer {
setup() {
super.setup();
console.log('uhuhuhu');
this.creates = this.props.archInfo.creates.length
? this.props.archInfo.creates
: [{ type: "create", string: env._t("Add a line++++") }]; }


}

and i have called it in manifest like 

'assets': {
'web.assets_backend': [
'med_exam/static/src/list_render.js',
],

},

Cann anyone explain why it is not working? Thanks,

アバター
破棄
最善の回答

Hi,

You can try adding it to the registry.Here's an example for you to refer: 


import { registry } from "@web/core/registry";
import { listView } from "@web/views/list/list_view";
import { ListRenderer } from "@web/views/list/list_renderer";

export class NewListRenderer extends Component {
    setup() {
         //Your code...    }}
export const newListView = {
    ...listView,
    Renderer: NewListRenderer,
};

registry.category("views").add("new_list_view", newListView);

アバター
破棄
著作者

Hey thanks for replying, so we don't need to use super function?

関連投稿 返信 ビュー 活動
1
1月 25
1288
1
6月 24
3088
2
4月 24
3041
0
12月 23
1632
1
10月 23
3173