如何检测添加到剑道窗口的视图上的单击或单击事件

how to detect onClick or click event on a view added to kendo window

本文关键字:单击 事件 窗口 视图 何检测 检测 添加      更新时间:2023-09-26

我有一个剑道窗口弹出窗口,我在触发某些事件时打开它。在该剑道窗口中,我使用window.content(new View().el添加了一个视图。视图包含多个div,其中一个具有 id 左箭头。点击div #leftArrow 我需要做点什么。但是我无法检测到onclick事件。我在视图中添加了单击事件侦听器,并为其提供了一个回调函数。当我单击事件侦听器断点时,事件正在触发,但不知何故没有在视图中侦听它。谁能说出问题出在哪里??

/*This is the controller file where I have created the kendo window and added view in it*/ 
var window = uiLayer.extWindow({
                elem : $('#popUp'),
                actions:["Close"],
                modal: true,
                animation: false,
                resizable: true,
                close: that.onClose,
                width: "95%",
                height: "95%",
                minHeight : "35%",
                minWidth : "60%",
                position:{
                    top:"1%",
                    left:"1%",
                    height:"100%",
                    width:"100%"
                }
              });
            window.open();
            window.content(new PopUpScrollLayoutView(this).el);
/*This is the view in which I have added various templates which contain the div #leftArrow . I have added click event in the events and given it a callback method. 
*/
  PopUpScrollLayoutView = Marionette.LayoutView.extend({
            initialize : function(options){
                console.log("Initialising EventContentView");
                console.log(options.getAllWidgets());
                var allWidgets = options.getAllWidgets();
                this.render(allWidgets);
            },
            events: {
                "click #leftArrow":"leftArrowClicked"
            },
            tagName: "div",
            className: "scrollContent",
            regions : {
                leftArrow : "#leftArrow",
                mainArea : "#mainArea",
                rightArrow : "#rightArrow",
                footer : "#footer"
            },
            render : function(allWidgets){
               this.$el.append(template());
                this.$el.append(mainAreaTemplate());
                this.$el.append(FooterAreaTemplate());
            },
          leftArrowClicked:function(e){
                console.log("Inside left arrow");
            }
    });

你可以使用 jQuery 来实现这个目的:

$("#leftArrow").click(leftArrowClicked);