问题描述
我正在寻找一个可以做到这一点的图书馆:
I'm looking for a library which do this :
- 通过AJAX调用检索JSON
- 使用JSON填充表
- 使用JSON(每x秒调用一次)实时更新表,仅删除或隐藏被删除的行或插入新行.
/第一个答案后进行编辑
/Editing after first answer
好吧,我想我的第一个解释不好.通过jQuery检索JSON并建立表是很好的,我可以做到,但是我的要求更多.我正在寻找一种以特殊方式显示结果的库.让我解释一下.
Ok I guess my first explanation was not good.Retrieving through jQuery a JSON and build a table is good, I could do that, but my request was more on the other part.I'm looking for a library to display the result in a special way.Let me explain.
Json请求1发送:
1;番茄2;苹果3;沙拉4;胡萝卜
Json request 1 send :
1;Tomato 2;Apple 3;Salad 4;Carot
Json请求2发送:
1;西红柿3;沙拉4;胡萝卜5;土豆
Json request 2 send :
1;Tomato 3;Salad 4;Carot 5;Potatoes
我希望第二行消失并带有效果(fadeOut),并且下面的行向上移动.对于第5行,我只希望出现带有淡入的新行.
I would like the second row disapear with a effect (fadeOut) and the rows below move Up. For the row 5, i just want a new row appears with a fade in.
更清楚吗?
是否有任何图书馆正在这样做?
Is there any library existing doing this?
我正在用PHP进行操作,但我希望用JS编写所有这些内容.
I'm doing it in PHP, but i hope to write all this in JS.
用户可以只查看表格并看到出现的新行和删除的旧行.
The user could just look the table and see the new rows appearing and the old rows deleting.
任何想法还是我应该从头开始写?
Any ideas or am I supposed to write it from scratch?
推荐答案
如果您想要友好且充满各种有用功能的东西,可以使用名为DataTables的jQuery插件.
If you want something friendly and full of various useful features, you can use jQuery plugin called DataTables.
它提供API,允许您根据请求从服务器提供新数据: http://www.datatables.net /api
It provides API allowing you to provide new data from the server on request: http://www.datatables.net/api
它也适用于简单的实现,可自定义,允许更改其外观等.
It works for simple implementations also, is pretty customizable, allows to change its outlook etc.
希望这很有用.
这篇关于使用JQUERY将JSON实时填充到表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!