如何检测添加到kendo窗口的视图上的onClick或click事件

时间:2014-12-04 06:20:16

标签: javascript jquery kendo-ui

我有一个kendo窗口弹出窗口,我在一些被触发的事件上打开。在那个kendo窗口中,我使用了window.content(new View()。el)添加了一个视图。该视图包含几个div,其中一个具有id leftarrow。 onclick on div #leftArrow我需要做点什么。但我无法检测到onclick事件。 我在视图中添加了click事件监听器并为其提供了一个回调函数。当我在点击时放置事件监听器断点时,事件正在触发,但不知何故它没有在视图中被监听。可以有人告诉问题在哪里吗?

/*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");
            }
    });

1 个答案:

答案 0 :(得分:0)

您可以将jQuery用于此目的:

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