Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4176 มุมมอง

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?

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ม.ค. 25
1531
1
มิ.ย. 24
3263
2
เม.ย. 24
3195
0
ธ.ค. 23
1727
1
ต.ค. 23
3263