Kendo UI Timepicker自定义间隔格式 [英] Kendo UI Timepicker custom interval format

查看:69
本文介绍了Kendo UI Timepicker自定义间隔格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对kendoTimePicker进行的操作是在直到11:30 PM的所有时间都设置30分钟间隔,但是在11:30之后显示所有后续时间,以每分钟间隔12AM间隔.不确定此控件是否支持.

What i'm looking to do with the kendoTimePicker is have the 30 minute interval for all times leading up to 11:30PM, but after 11:30 display all subsequent times up to 12AM in minute interval. Not sure if this control supports it.

基本上希望拥有这样的东西:

Basically looking to have something like this:

晚上10:30
11:00 PM
下午11:30
下午11:31
下午11:32
下午11:33
..etc

10:30 PM
11:00 PM
11:30 PM
11:31 PM
11:32 PM
11:33 PM
..etc

推荐答案

我能想到的唯一方法是手动更改下拉列表中的时间列表. Kendo只是在页面上动态添加一个<ul>,显示为弹出窗口,因此您可以自己清除并重建列表.

The only way I could think of doing it is to manually change the list of times in the dropdown. Kendo just dynamically adds a <ul> to your page that is shown as the popup, so you could clear and rebuild the list yourself.

类似的东西:

<input id="timepicker" />

$("#timepicker").kendoTimePicker();
var listOfTimes = $("#timepicker_timeview");

// remove all existing <li> elements
listOfTimes.empty();

// add the times you want...
listOfTimes.append('<li tabindex="-1" role="option" class="k-item" unselectable="on">12:00 PM</li>');
listOfTimes.append('<li tabindex="-1" role="option" class="k-item" unselectable="on">12:01 PM</li>');
listOfTimes.append('<li tabindex="-1" role="option" class="k-item" unselectable="on">12:02 PM</li>');
// ...etc...

或者从完全填充的列表开始,然后删除不需要的列表.无论哪种方式,您都可以通过使用jQuery编辑<ul>来操纵列表.

Or start with a fully populated list and just remove the ones you don't want. Either way, you can manipulate the list by just editing the <ul> with jQuery.

这篇关于Kendo UI Timepicker自定义间隔格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆