Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4 Antwoorden
5694 Weergaven

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. 

Avatar
Annuleer
Auteur Beste antwoord

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.

Avatar
Annuleer
Beste antwoord

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



Thank you!!

Avatar
Annuleer
Beste antwoord

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',
}),
Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
mei 21
15868
1
apr. 21
4606
1
apr. 20
3210
0
mrt. 20
2337
1
feb. 20
4048