Kendo UI for jQuery最新试用版下载

Kendo UI目前最新提供Kendo UI for jQuery、Kendo UI for Angular、Kendo UI Support for React和Kendo UI Support for Vue四个控件。Kendo UI for jQuery是创建现代Web应用程序的最完整UI库。

所有Kendo UI小部件都提供可用于在运行时查询或修改其状态的方法和事件。

获取Widget实例
  • 使用jQuery数据方法
  • 使用getKendo <WidgetName>方法
jQuery数据方法

The Kendo UI widgets是jQuery插件,获取对窗口小部件实例的引用常用方法是使用jQuery数据方法并将插件名称作为字符串传递。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4.   // create a new widget instance
  5.   $("#animal").kendoAutoComplete({ dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ] });
  6. // retrieve the widget instance
  7.   var autoComplete = $("#animal").data("kendoAutoComplete");
  8. console.log(autoComplete);
  9.   });
  10.   </script>
getKendo方法

要获取对窗口小部件实例的引用,您还可以使用getKendo <WidgetName>方法。 请注意,返回所选DOM元素的jQuery约定也适用于窗口小部件初始化插件方法。 这意味着插件方法(例如kendoAutoComplete())不返回窗口小部件实例,而是返回使用该方法的jQuery选择器。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4.   // create a new widget instance
  5.   $("#animal").kendoAutoComplete({ dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ] });
  6. // retrieve the widget instance
  7.   var autoComplete = $("#animal").getKendoAutoComplete();
  8. console.log(autoComplete);
  9.   });
  10.   </script>
使用方法

在窗口小部件实例可用后,您可以使用标准JavaScript方法语法调用其方法。 API参考部分中提供了窗口小部件方法和方法参数的完整列表和示例。 如果返回窗口小部件实例的代码返回undefined,则窗口小部件尚未初始化。 例如,如果在document.ready处理程序中创建窗口小部件但是从先前执行的代码引用窗口小部件实例,则可能发生此类问题。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4.   $("#animal").kendoAutoComplete({ dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ] });
  5. var autoComplete = $("#animal").data("kendoAutoComplete");
  6. // focus the widget
  7.   autoComplete.focus();
  8.   });
  9.   </script>
处理Widget事件

每个小部件根据其特定功能公开不同的事件。 例如,AutoComplete小部件会触发change,close,dataBound等。 您可以在窗口小部件初始化期间或窗口小部件初始化之后传递事件处理程序。 使用Kendo UI小部件的事件时,还可以使用事件处理程序参数,阻止事件和取消绑定事件。

初始化期间绑定事件

每次触发事件时,都会执行在窗口小部件初始化期间附加的事件处理程序。 要仅执行一次处理程序,请在使用一种方法进行窗口小部件初始化后附加它。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4. $("#animal").kendoAutoComplete({
  5.   dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ],
  6.   change: function(e) {
  7.   console.log("change event handler");
  8.   }
  9.   });
  10. });
  11.   </script>
初始化后绑定事件

所有Kendo UI小部件都提供绑定和一种方法。 这两种方法都将事件处理程序附加到现有的窗口小部件实例,但是附加一个事件处理程序的处理程序只会执行一次。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4. $("#animal").kendoAutoComplete({
  5.   dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ]
  6.   });
  7. // ...
  8. var autocomplete = $("#animal").data("kendoAutoComplete");
  9. // Attach an event handler that will be executed each time the event is fired.
  10.   autocomplete.bind("change", function(e) {
  11.   console.log("change event handler");
  12.   });
  13. // Attach an event handler that will be executed only the first time the event is fired.
  14.   autocomplete.one("open", function(e) {
  15.   console.log("open event handler");
  16.   });
  17. });
  18.   </script>
使用事件处理程序参数

每个Kendo UI小部件都将一个参数传递给事件处理程序 - 即所谓的“事件对象”。 通常,它有一个或多个字段,其中包含事件的特定信息。 所有事件对象都有一个sender字段,该字段提供对触发事件的窗口小部件实例的引用。不支持将其他自定义事件参数传递给处理程序,API参考部分中提供了窗口小部件事件的完整列表和示例以及事件对象中的字段。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4. $("#animal").kendoAutoComplete({
  5.   dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ],
  6.   open: function(e) {
  7.   var autocomplete = e.sender;
  8.   }
  9.   });
  10. });
  11.   </script>
预防事件

通过调用事件对象的preventDefault方法可以防止某些窗口小部件事件。 事件预防的效果特定于每个事件,并在API参考中记录。

  1. <p>Animal: <input id="animal" /></p>
  2. <script>
  3.   $(function() {
  4.   $("#animal").kendoAutoComplete({
  5.   dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ]
  6.   });
  7. var autoComplete = $("#animal").data("kendoAutoComplete");
  8. // prevent the autocomplete from opening the suggestions list
  9.   autoComplete.bind('open', function(e) {
  10.   e.preventDefault();
  11.   });
  12.   });
  13.   </script>
从事件中解除绑定

要取消绑定特定事件,请保持对事件处理函数的引用,并使用它调用unbind方法。 请注意,在没有任何参数的情况下调用unbind方法会从事件中取消绑定所有事件处理程序。

  1. <p>Animal: <input id="animal" /></p>
  2. <button id="unbindButton">Unbind event</button>
  3. <script>
  4.   $(function() {
  5.   var handler = function(e) { console.log(e); };
  6.   $("#animal").kendoAutoComplete({ dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ] });
  7. var autoComplete = $("#animal").data("kendoAutoComplete");
  8. autoComplete.bind("open", handler);
  9. $("#unbindButton").on("click", function() {
  10.   autoComplete.unbind("open", handler);
  11.   });
  12.   });
  13.   </script>
已知限制

当调用相应的方法时,Kendo UI不会触发事件。 例如,如果通过API调用select方法,则不会触发Kendo UI PanelBar小部件的select事件。


Kendo UI R2 2019 SP1全新发布,最新动态请持续关注Telerik中文网!

扫描关注慧聚IT微信公众号,及时获取最新动态及最新资讯

Kendo UI for jQuery使用教程:方法和事件的更多相关文章

  1. Kendo UI for jQuery使用教程:使用MVVM初始化(二)

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  2. Kendo UI for jQuery使用教程:使用MVVM初始化(一)

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  3. Kendo UI for jQuery使用教程:初始化jQuery插件

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  4. Kendo UI for jQuery使用教程:入门指南

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  5. Kendo UI for jQuery使用教程:小部件DOM元素结构

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  6. Kendo UI for jQuery使用教程——创建自定义捆绑包

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  7. Kendo UI for jQuery使用教程——使用NPM/NuGet进行安装

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  8. Kendo UI for jQuery使用教程:操作系统/jQuery支持等

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  9. Kendo UI for jQuery使用教程:支持Web浏览器

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

随机推荐

  1. Mybatis操作数据时出现:java.sql.SQLSyntaxErrorException: Unknown column 'XXX' in 'field list'

    这个错误比较重要,而且很常见,故单独进行说明: Mybatis出现:Unknown column 'xxx' in 'field list' 先来看一下程序的内部: dao.addUser(" ...

  2. 【AMAD】stackprint -- 为Python加入利于调试的traceback信息

    简介 动机 作用 用法 热度分析 源码分析 个人评分 简介 为Python加入利于调试的traceback信息.  动机 Python抛出异常时,会显示一些traceback信息.但是,一些时候这些 ...

  3. 差分+贪心:IncDec序列

    原题 题目描述给定一个长度为 n 的数列 a1,a2,…,ana1,a2,…,an,每次可以选择一个区间 [l,r][l,r],使下标在这个区间内的数都加一或者都减一. 求至少需要多少次操作才能使数列 ...

  4. mysql 速度优化

    1.添加索引 ALTER TABLE `cw_base_house` ADD INDEX idx_house ( `villageCode`, `buildingNo`, `unitNo`, `hou ...

  5. 瀑布布局(waterflall flow)实现

    瀑布流,又称瀑布流式布局.是比较流行的一种网站页面布局,视觉表现为参差不齐的多栏布局,随着页面滚动条向下滚动.这种布局还会不断加载数据块并附加至当前尾部.最早采用此布局的网站是Pinterest,逐渐 ...

  6. Python学习教程:Pandas中第二好用的函数

    从网上看到一篇好的文章是关于如何学习python数据分析的迫不及待想要分享给大家,大家也可以点链接看原博客.希望对大家的学习有帮助. 本次的Python学习教程是关于Python数据分析实战基础相关内 ...

  7. coredump产生的几种可能情况

    coredump产生的几种可能情况 造成程序coredump的原因有很多,这里总结一些比较常用的经验吧: 1,内存访问越界 a) 由于使用错误的下标,导致数组访问越界. b) 搜索字符串时,依靠字符串 ...

  8. 云数据库 Redis 版

    首先观看视频简介 云数据库 Redis 版是一项易于部署和管理的按需数据库服务,与 Redis 协议兼容.云数据库 Redis 版通过从内存缓存中检索数据而提供高速数据读写功能,并通过同时使用内存和硬 ...

  9. 区间前k小的和(权值线段树+离散化)--2019牛客多校第7场C--砍树

    题目链接:https://ac.nowcoder.com/acm/contest/887/C?&headNav=acm 题意: 给你 n 种树,有 高度,花费和数量 ,现在问你最少需要花多少钱 ...

  10. # 丢包&&掉帧&&文件删除

    丢包&&掉帧&&文件删除 丢包:指一个或多个数据包(packet)的数据无法透过网络到达目的地,丢失一些信息 掉帧:帧数就是在1秒钟时间里传输的图片的量,每一帧都是静止 ...