jQuery Tablesorter Date Picker [英] jQuery Tablesorter Date Picker

查看:117
本文介绍了jQuery Tablesorter Date Picker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在日程表中实施日期选择器,以便在日期之间显示一个结果 01/01/2001 - 01/01/2012

How would I go about the implementation of a date picker into Tablesorter so that I can show a result between to dates 01/01/2001 - 01/01/2012?

我已经提出了以下问题,因此我对上述问题的查询:

I have been given the following question hence my query regarding the question above:

在HTML显示一组表格数据,其中数据包含日期。实施过滤表格数据的日期选择器。

In HTML display a set of tabular data where the data contains dates. Implement a date picker that filters the tabular data. Where possible allow for the tabular data to be supplied via ajax or json feeds.

推荐答案

正如我之前所说的那样,您可以通过简单地使用2 jQuery UI日期检查器 - 一个最小日期,另一个最大日期 - 并过滤日期。

As I commented before, you can do this by simply using 2 jQuery UI datepickers - one for min date, another for max date - and filtering the dates.

我做了一个非常简单的例子,看看。而这里是已评论的版本(您也可以输入数字与日期提醒者,这可能证明是一个更简单的方法)。

I've made an extremely simple example, Take a look. And here's the commented version (you can also type the numbers in conjunction with the datepickers, which may prove to be an easier way around).

现在,如果你想在div内动态加载内容,你只需要看看 jQuery的Ajax文档或阅读一些教程 - 这是非常基本的东西。

Now, if you want to load content dynamically inside of a div, you just have to take a look at the jQuery's Ajax documentation or read some tutorials - that's pretty basic stuff.

最简单的方法是使您的Ajax将您的表格包装在div中,比如说 tablewrapper ,那么您可以使用 .load() jQuery方法:

The simplest way to make your Ajax would be wrapping your table inside a div, say, tablewrapper then you can use the .load() jQuery method:

$('#tablewrapper').load('UrlWhichContainsMyTable.html');

在上面的示例中,您将回显整个< table> ...< / table> (或将其放在html文档中)

In the example above you'd echo a whole <table> ... </table> (or have it inside a html document).

如果要动态加载表行,可以使用 .append .appendTo 方法:

If you want to load table rows dynamically, you can use .append and .appendTo methods to your table:

$.get('urlWithMyNewRows.html', function(r){ //or $.post, $.ajax etc
      $('table.bordered').append(r);
});

在上面的示例中,您将获取表行集合 ; tr> 从您的 urlWithMyNewRows.html 文档附加到您的表格。

In the example above, you'd fetch a collection of table rows <tr> to append to your table from your urlWithMyNewRows.html document.

如果需要,请查看 $ .getJSON文档和示例。 =]

And take a look at $.getJSON documentation and examples if you need it. =]

ps。我叫我的小提琴简单,因为如果 maxdate mindate 之前,我甚至没有验证,以显示警告既不显示找不到结果信息,即使这些信息也只是几行代码。

ps. I call my fiddle "simple" as I didn't even validate if the maxdate is before the mindate to display an warning neither show a "No results found" message, even though those are just a couple lines of code as well.

这篇关于jQuery Tablesorter Date Picker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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