jQuery Tablesorter Date Picker

懵懂的女人 提交于 2019-12-03 21:53:30

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).

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.

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');

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

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);
});

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!