简体   繁体   English

Kendo UI 如何将参数传递给模态?

[英]Kendo UI How to pass parameter to modal?

modalOpen: function(data){
        var _this = this;
        var item = JSON.stringify(data);

        var callType = "OrderNo_31";

        var id = 'window'+ ax5.util.date(new Date(), {return: 'yyyyMMddhhmmss'});


        _this.commonModal = $("<div><iframe class='k-content-frame' callType='" + callType + "' src='/jsp/mes/common/orderDetail-modal.jsp?orderNo="+callType+"' frameborder=\"0\" framespacing=\"0\" style=\"width:100%;height:100%;display:block;\"></div>").kendoWindow({

            width: '900px',
            height: '400px',
            position: {
                top: '100',
                left: '50%'
            },
            title: 'product reg',
            modal: true,
            data: {orderNo:"orderNo_30"}
        });

        _this.commonModal.data("kendoWindow").center().open();
    },

I use modal in the same way as above.我以与上面相同的方式使用模态。 (Although there are other ways) I want to know how to pass parameters in this way. (虽然还有其他方式)我想知道如何通过这种方式传递参数。

I tried ?orderNo = orderNo_30 and tried data: {orderNo: "orderNo_30"} but don't know how to use this data in Modal.我试过 ?orderNo = orderNo_30 并试过 data: {orderNo: "orderNo_30"} 但不知道如何在 Modal 中使用这些数据。

How can I use it?我怎样才能使用它?

The second one, data: {orderNo: "orderNo_30"} , is not an option documented at https://docs.telerik.com/kendo-ui/api/javascript/ui/window .第二个, data: {orderNo: "orderNo_30"} ,不是https://docs.telerik.com/kendo-ui/api/javascript/ui/window 中记录的选项。

The first one, the GET param in URL, should work.第一个,URL 中的 GET 参数应该可以工作。

There's another way, that's generating your variable window content and passing it to the content method:还有另一种方法,即生成您的可变窗口内容并将其传递给content方法:

$("#dialog").kendoWindow();
var dialog = $("#dialog").data("kendoWindow");
var callType = "OrderNo_31";  
function getContentContent(callType) {
    return `Here's your content for ${callType}`
}    
dialog.content(getContentContent(callType));

Dojo: https://dojo.telerik.com/@GaloisGirl/urAQoHiY道场: https : //dojo.telerik.com/@GaloisGirl/urAQoHiY

If you need to fetch some data for the product from a server (a database for example), you need to add async/await to that example, or use the solution with the GET parameter.如果您需要从服务器(例如数据库)获取产品的一些数据,则需要向该示例添加async/await ,或使用带有 GET 参数的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM