微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 Kendo-UI 向导 ASP.NET Core 中,如何通过单击从服务器获取数据?

如何解决在 Kendo-UI 向导 ASP.NET Core 中,如何通过单击从服务器获取数据?

如何向我的 razor 页面方法提交异步/ajax 调用或在向导的步骤中进行自定义验证?

例如:我想根据上一步输入的内容填充每个步骤中的数据。我查看了示例,但它们似乎没有显示此类用例。

documentation samples 中,显示了事件,但不清楚如何将步骤的特定完成(单击下一步)绑定到特定事件函数(以标签助手格式)。

.Events(events =>
        {
            events.Activate("onActivate");
            events.Error("onError");
            events.Done("onDone");
            events.Select("onSelect");
            events.Reset("onReset");
            events.ContentLoad("onContentLoad");
            events.FormValidateFailed("onFormValidateFailed");
        })

使用标签助手并试图找出如何绑定到步骤的事件时的屏幕截图:

enter image description here

enter image description here

解决方法

事件与向导的步骤无关 - 它们处于向导级别:

    <kendo-wizard name="wizard" on-activate="onActivate" on-select="onSelect">
        <wizard-steps>
            <wizard-step title="Initial step">
                <wizard-step-content>
                    <h1>Initial step content</h1>
                </wizard-step-content>
            </wizard-step>
            <wizard-step title="Second step">
                <wizard-step-content>
                    <h1>Second step content</h1>
                </wizard-step-content>
            </wizard-step>
            <wizard-step title="Final step">
                <wizard-step-content>
                    <h1>Final step content</h1>
                </wizard-step-content>
            </wizard-step>
        </wizard-steps>
    </kendo-wizard>

    <script>
        function onActivate(e) {
            console.log("Activated: " + e.step.options.label);

           switch (e.step.options.label) {
             case 'step 1':
               //do what you need to here
               break;
             }
             case 'step 2':
               //do step 2 stuff here
               $.ajax({ whatever });
               break;
             default:
           }
        }

        function onSelect(e) {
            console.log("Selected: " + e.step.options.label);
        }

然后,在事件处理函数中 - 您可以根据触发事件的步骤来确定您想要做什么 - 使用 e.step.options.label(或那里的其他属性)。从位于 https://demos.telerik.com/aspnet-core/wizard/events 的示例中,它们输出触发每个事件的步骤的标题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?