콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
11606 화면

Hello guys, am new to odoo and would like a simple walkthrough on how I can write proper jquery to target web elements in a view, am using odoo 12. I am knowledgeable on how to write jQuery and have successfully included my js script from static/js/myscript.js. When I write my usual jQuery commands, nothing works, could anyone offer some help? I simply want to target all buttons with the class name "oe_stat_button" and give them a red background.

odoo.define('mubs.Sidebar', function(require) { 

 "use strict"; 

 var core = require('web.core'); 

 var session = require('web.session');    

var Widget = require('web.Widget'); 

 $(function() {     

(jQuery);    

$(".oe_stat_button").css("background", "red !important");        

 });

});



아바타
취소

Please post some more details what your are doing or post your code you are trying.

베스트 답변
Hi Lordkrum,
Please refer the code given below,
odoo.define('mubs.Sidebar', function(require) {
"use strict";
var core = require('web.core');
var session = require('web.session');
var SystrayMenu = require('web.SystrayMenu');
var Widget = require('web.Widget');

var SideBar = Widget.extend({
    init: function (parent) {
        this._super.apply(this, arguments);
        $('.oe_stat_button').css('background-color', 'red');
    },
    });
return SideBar;
});
Hope this answer helps you,
Thanks & Regards

아바타
취소
관련 게시물 답글 화면 활동
1
8월 19
3792
0
2월 17
2404
0
6월 22
2376
0
2월 22
2405
1
3월 19
5058