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

Hello,

I am trying to add an event on tags of many2many fields if form is in edit mode. For that I have written below code:

var FieldMany2ManyTags = relationalField.FieldMany2ManyTags.extend({
events: _.extend({}, FieldMany2ManyTags.prototype.events, {
'click .o_tag_color_0': '_onClickTag',
}),

_onClickTag: function(events){
console.log('Test');
alert('many2many tag');
},

But click on tags click event is not call. It give me following error on inspect console as:

TypeError: Cannot read property 'prototype' of undefined

 I am doing somthing wrong?  Any alternative way is available for the same

Thanks In advance. 

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Use:

events: _.extend({}, relationalField.FieldMany2ManyTags.prototype.events, {
'click .badge': '_onClickTag',
}),


instead of:

events: _.extend({}, FieldMany2ManyTags.prototype.events, {
'click .o_tag_color_0': '_onClickTag',
}),


Hope this will help  others.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Thanx for sharing this amazing article, really helpful https://mybk-experience.onl https://www.mcdvoicesurvey.onl/



Thank you!!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello

Try

events: _.extend({}, relationalField.FieldMany2ManyTags.prototype.events, {
'click .o_tag_color_0': '_onClickTag',
}), 

 instead of

 events: _.extend({}, FieldMany2ManyTags.prototype.events, {
'click .o_tag_color_0': '_onClickTag',
}),
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Use:

events: _.extend ({}, relationalField.FieldMany2ManyTags.prototype.events, {
        'click .badge': '_onClickTag',
    }),

    _onClickTag: function (event) {
        console.log ('custom _onclick');
    }
  

https://get-shareit.com
https://get-vidmateapk.com

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 21
15950
1
เม.ย. 21
4718
1
เม.ย. 20
3283
0
มี.ค. 20
2379
Creation of DOM from XML แก้ไขแล้ว
1
ก.พ. 20
4092