【问题标题】:Passing value to a kendoWindow template将值传递给 kendoWindow 模板
【发布时间】:2015-11-25 11:00:00
【问题描述】:

鉴于下面的模板和函数,我如何传递函数参数contentText 以在模板#password-validation 的占位符### 处显示?

模板

<script id="password-validation" type="text/x-kendo-template">
    <p style="font-size: 12px; padding: 10px">
        ###
    </p>
    <div style="text-align: right">
        <button class="password-ok k-button">OK</button>
    </div>
</script>

功能

function PasswordValidation(contentText) {

var kendoWindow = $("<div />").kendoWindow({
    actions: ["Close"],
    title: "Password validation",
    resizable: false,
    modal: true
});

kendoWindow.data("kendoWindow")
    .content($("#password-validation").html())
    .center().open();

kendoWindow
    .find(".password-ok")
        .click(function () {
            kendoWindow.data("kendoWindow").close();
        })
        .end()
}

【问题讨论】:

    标签: kendo-ui kendo-window


    【解决方案1】:

    这里有解决方案:

    <script id="password-validation" type="text/x-kendo-template">
        <p style="font-size: 12px; padding: 10px">
            #=data#
        </p>
        <div style="text-align: right">
            <button class="password-ok k-button">OK</button>
        </div>
    </script>
    

    和功能:

    function PasswordValidation(contentText) {
        var kendoWindow = $("<div />").kendoWindow({
            actions: ["Close"],
            title: "Password validation",
            resizable: false,
            modal: true
        });
    
        var template = kendo.template($("#password-validation").html());
        kendoWindow.data("kendoWindow")
            .content(template(contentText))
            .center().open();
    
        kendoWindow
            .find(".password-ok")
                .click(function () {
                    kendoWindow.data("kendoWindow").close();
                })
                .end()
    }
    

    【讨论】:

    • 就是这样。 :) 非常感谢
    猜你喜欢
    • 2014-08-27
    • 2017-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-17
    • 2019-08-25
    • 2017-12-25
    • 2019-02-15
    相关资源
    最近更新 更多