繁体   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();
    },

我以与上面相同的方式使用模态。 (虽然还有其他方式)我想知道如何通过这种方式传递参数。

我试过 ?orderNo = orderNo_30 并试过 data: {orderNo: "orderNo_30"} 但不知道如何在 Modal 中使用这些数据。

我怎样才能使用它?

第二个, data: {orderNo: "orderNo_30"} ,不是https://docs.telerik.com/kendo-ui/api/javascript/ui/window 中记录的选项。

第一个,URL 中的 GET 参数应该可以工作。

还有另一种方法,即生成您的可变窗口内容并将其传递给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));

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

如果您需要从服务器(例如数据库)获取产品的一些数据,则需要向该示例添加async/await ,或使用带有 GET 参数的解决方案。

暂无
暂无

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

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