从kendoWindow获取数据

时间:2015-07-14 22:21:21

标签: javascript jquery asp.net-mvc kendo-ui

目前,我只是想打开一个窗口,并获取用户输入的数据值。这是我的代码:

function execGetKey() {
    var win = $('#w').kendoWindow({
        modal: true,
        resizable: false,
        title: 'Please Enter a Key',
        visible: false,
        activate: function () {
            $('#t').select();
        },
        editItem: function(e) {
            var dataItem = this.dataItem($(e.target).closest("tr"));
            kendo.bind($("#w"), dataItem);
            e.preventDefault();
            kendo.bind(win, dataItem);
        },
        close: function (e) {
            console.log("win:");
            for (var prop in win) {
                if (win.hasOwnProperty(prop)) {
                    console.log(prop);
                    console.log(win[prop]);
                }
            }
            console.log("e:");
            for (var prop in e) {
                if (e.hasOwnProperty(prop)) {
                    console.log(prop);
                    console.log(e[prop]);
                }
            }  
        }
    }).data('kendoWindow');
    win.center().open();   
}

以下是kendoWindow上的所有属性,但所有这些属性都没有找到用户输入的值:

match.config.js:640 element
match.config.js:641 [div#w.k-window-content.k-content, context: div#w.k-window-content.k-content]
match.config.js:640 _events
match.config.js:641 Object {activate: Array[1], close: Array[1]}
match.config.js:640 options
match.config.js:641 Object {prefix: "", name: "Window", animation: Object, title: "Please Enter a Key", actions: Array[1]…}
match.config.js:640 appendTo
match.config.js:641 [body, prevObject: A.fn.init[1], context: document, selector: "body"]
match.config.js:640 wrapper
match.config.js:641 [div.k-widget.k-window, prevObject: A.fn.init[1], context: div#w.k-window-content.k-content]
match.config.js:640 dragging
match.config.js:641 s {owner: c.e…d.init, _draggable: _.e…d.init}
match.config.js:640 touchScroller
match.config.js:641 false
match.config.js:640 _resizeHandler
match.config.js:641 jQuery.extend.proxy.proxy()
match.config.js:640 _marker
match.config.js:641 97742b0d
match.config.js:640 _closing
match.config.js:641 false

有没有人有任何建议? TIA。

更新

这是我在调试和检查关闭事件时发现的,但目前尚不清楚,我该如何访问这个" 10117434-000" js代码中的值?

c.e…d.init {element: A.fn.init[1], _events: Object, options: Object, appendTo: A.fn.init[1], wrapper: A.fn.init[1]…}
   //...
   element: A.fn.init[1]0: div#w.k-window-content.k-content
      //...
      childNodes: NodeList[3]
          0: textbaseURI: "http://localhost:41678/Match.mvc/Config"childNodes: NodeList[0]length: 0__proto__: NodeListdata:        //...
          1: input#taccept: ""accessKey: "" 
              //...
              value: "10117434-000"
              //...

1 个答案:

答案 0 :(得分:0)

好的,明白了 - 这是我需要的价值,虽然这绝对是一种从剑道中的对话框中获取值的复杂方式:

e.sender.element[0].childNodes[1].value