跳至內容
選單
此問題已被標幟
4 回覆
5699 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
5月 21
15869
1
4月 21
4608
1
4月 20
3211
0
3月 20
2338
1
2月 20
4049