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数据方法并将插件名称作为字符串传递。

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

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

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

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

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

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

初始化期间绑定事件

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

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

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

<p>Animal: <input id="animal" /></p>
<script>
  $(function() {
$("#animal").kendoAutoComplete({
  dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ]
  });
// ...
var autocomplete = $("#animal").data("kendoAutoComplete");
// Attach an event handler that will be executed each time the event is fired.
  autocomplete.bind("change", function(e) {
  console.log("change event handler");
  });
// Attach an event handler that will be executed only the first time the event is fired.
  autocomplete.one("open", function(e) {
  console.log("open event handler");
  });
});
  </script>
使用事件处理程序参数

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

<p>Animal: <input id="animal" /></p>
<script>
  $(function() {
$("#animal").kendoAutoComplete({
  dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ],
  open: function(e) {
  var autocomplete = e.sender;
  }
  });
});
  </script>
预防事件

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

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

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

<p>Animal: <input id="animal" /></p>
<button id="unbindButton">Unbind event</button>
<script>
  $(function() {
  var handler = function(e) { console.log(e); };
  $("#animal").kendoAutoComplete({ dataSource: [ "Ant", "Antilope", "Badger", "Beaver", "Bird" ] });
var autoComplete = $("#animal").data("kendoAutoComplete");
autoComplete.bind("open", handler);
$("#unbindButton").on("click", function() {
  autoComplete.unbind("open", handler);
  });
  });
  </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. 串口使用和CSerial类

    1 串口通信的基本原理 串口通信中无论是写入串口还是读取串口,都是对缓冲区操作的.可以理解为写串口就是向输出缓冲区写入内容,读取串口就是从输入串口缓冲区读取内容.但是何时打开串口,何时发送数据,何时接 ...

  2. 【Python开发】python使用urllib2抓取防爬取链接

    前几天刚看完<Linux/Unix设计思想>,真是一本不错的书,推荐想提高自己代码质量的童鞋看一下,里面经常提到要以小为美,一个程序做好一件事,短小精悍,因此我也按照这种思想来写pytho ...

  3. TCP/IP 物理层卷三 -- 传输介质

    一.有线传输介质(Guided Transmission Media)  1.1 双绞线(Twisted Pair) 双绞线(twisted pair)是一种综合布线工程中最常用的有线传输介质(导向传 ...

  4. 分层最短路(牛客第四场)-- free

    题意: 给你边权,起点和终点,有k次机会把某条路变为0,问你最短路是多长. 思路: 分层最短路模板题.题目有点坑(卡掉了SPFA,只能用dijkstra跑的算法). #include<iostr ...

  5. thinkPHP模型before_insert新增前 before_update更新前 before_write写入前 区别

    thinkPHP模型中有个save方法,可用于新增数据和修改数据,这里容易出现混淆. 经过调试: before_write,不管是插入新数据还是修改数据都会执行: before_insert,只有插入 ...

  6. cut,sort,awk,sed,tr,find,wc,uniq在Linux中的用法

    cut语法cut [-bn] [file]cut [-c] [file]cut [-df] [file] -b :以字节为单位进行分割.这些字节位置将忽略多字节字符边界,除非也指定了 -n 标志.-c ...

  7. Wizard's Tour CodeForces - 860D (图,构造)

    大意: 给定$n$节点$m$条边无向图, 不保证连通, 求选出最多邻接边, 每条边最多选一次. 上界为$\lfloor\frac{m}{2}\rfloor$, $dfs$贪心划分显然可以达到上界. # ...

  8. windows10升级更新1709版本 在桌面和文件夹中点击右键刷新,会引起卡顿反应慢

    win10,升级更新,1709,右键,卡机,刷新,反应慢,桌面,文件夹 windows自动升级到1709版本后出现的问题,而之前是没有这种问题的. 最终解决办法:(需要设置注册表) 运行:快捷键Win ...

  9. 类的函数成员之属性property

    属性命名采用Pascal命名方式,每个单词的首字母大写.访问方式与访问类的公共字段类似. /// <summary> /// 字段 /// </summary> private ...

  10. Hadoop大数据平台入门——HDFS和MapReduce

    随着硬件水平的不断提高,需要处理数据的大小也越来越大.大家都知道,现在大数据有多火爆,都认为21世纪是大数据的世纪.当然我也想打上时代的便车.所以今天来学习一下大数据存储和处理. 随着数据的不断变大, ...