1
こんにちは私はodooバックエンドでフォームビューにchessboardjsを表示しようとしていますが、最終的にボードを表示するウィジェットを作っています。なぜ作品を除いて、うまく動作するように見えるのかわかりません。オプションでdragable : true
を使用し、隠しピースを移動すると、ボードはすべてのピースでレンダリングされます。チェス盤がうまくレンダリングされていないということを私のコード上で見逃していますか? はここマイルウィジェットコードです:...odooフォームウィジェットでチェスボードjsを表示しようとしましたが、エラーはありませんピース
(function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
openerp.chess_base = function (instance, local) {
local.YourWidgetClassName = instance.web.form.FormWidget.extend({
start: function() {
this.$el.append('<div id="board" style="width: 300px">BOARD GOES HERE</div>'); // creating the board in the DOM
this.onBoard();
},
onBoard: function (position, orientation) {
if (!position) {
this.position = 'start'
} else {
this.position = position
}
if (!orientation) {
this.orientation = 'white'
} else {
this.orientation = orientation
}
this.el_board = this.$('#board');
this.cfg = {
position: this.position,
orientation: this.orientation,
draggable: false,
pieceTheme: '/chess_base/static/img/chesspieces/wikipedia/{piece}.png'
};
this.board = ChessBoard(this.el_board, this.cfg);
}
});
instance.web.form.custom_widgets.add('widget_tag_name', 'instance.chess_base.YourWidgetClassName');
}
})(openerp);