从mysql查询中排序结果而不提交新查询

时间:2022-10-13 09:43:18

So I have a database with 50 or so lenses and their attributes. I have a simple php script to let the user enter in min and max values from none/some/all of the attributes and then display a table with the corresponding lenses. What I'd like to be able to do is after the lenses are displayed is to have the legend clickable to sort the lenses and their attributes. I've done a bit of searching but can't find anything implemented easily.

所以我有一个拥有50个左右镜头及其属性的数据库。我有一个简单的PHP脚本让用户输入来自无/部分/全部属性的最小值和最大值,然后显示带有相应镜头的表格。我希望能够做的是在显示镜头后,可以点击图例来对镜头及其属性进行分类。我做了一些搜索,但找不到任何容易实现的东西。

2 个解决方案

#1


4  

Given the small number of results you want to re-sort, you can certainly do that in the web browser rather than making a round-trip back to the server.

鉴于您想要重新排序的结果数量很少,您当然可以在Web浏览器中执行此操作,而不是往返于服务器。

If you can use jQuery, there are a number of grid controls that allow for sorting in the web browser, e.g.:

如果你可以使用jQuery,有许多网格控件允许在Web浏览器中进行排序,例如:

http://tablesorter.com/docs/

Search for jquery grid sortable to find many other options.

搜索jquery网格可排序以查找许多其他选项。

#2


0  

This jQuery plugin has built in AJAX functionality that could be useful in your case:

这个jQuery插件内置了AJAX功能,可以在你的情况下使用:

http://datatables.net/

#1


4  

Given the small number of results you want to re-sort, you can certainly do that in the web browser rather than making a round-trip back to the server.

鉴于您想要重新排序的结果数量很少,您当然可以在Web浏览器中执行此操作,而不是往返于服务器。

If you can use jQuery, there are a number of grid controls that allow for sorting in the web browser, e.g.:

如果你可以使用jQuery,有许多网格控件允许在Web浏览器中进行排序,例如:

http://tablesorter.com/docs/

Search for jquery grid sortable to find many other options.

搜索jquery网格可排序以查找许多其他选项。

#2


0  

This jQuery plugin has built in AJAX functionality that could be useful in your case:

这个jQuery插件内置了AJAX功能,可以在你的情况下使用:

http://datatables.net/