动态过滤,我做错了吗?

发布于 2024-09-29 13:48:40 字数 261 浏览 1 评论 0原文

因此,我有一个 umbraco 网站,其中包含许多内容管理的产品,我需要根据 5 个条件在前端搜索/过滤此数据集。

我估计我会有 300 种产品。我需要非常快速地过滤这些数据,并根据之前的选择隐藏不再相关的显示选项。

我目前正在使用 AJAX 构建 Web 服务和 jquery 实现。

最好的方法是将其加载到 JavaScript 数据结构中并在那里对其进行操作,还是 AJAX 调用足够快?显然,这意味着为非 JavaScript 用户复制服务器端的功能。

So I have an umbraco site with a number of products in it that is content managed, I need to search/filter this dataset on the front end based on 5 criteria.

I'd estimate I will have 300 products. I need to filter this data very fast and hide show options that are no longer relevant based on the previous selections.

I'm currently building a webservice and jquery implementation using AJAX.

Is the best way to do this to load it into a javascript data structure and operate on it there or will AJAX calls be fast enough? Obviously this will mean duplicating the functionality on the server side for non-javascript users.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终止放荡 2024-10-06 13:48:40

如果您需要“非常快”地过滤数据,那么我想最好的方法是预加载所有数据,然后在客户端进行操作。如果每次用户需要过滤数据时您都在等待 Ajax 响应,那么它不会像在客户端上过滤数据那么快(假设他们没有运行 IE6 的古老计算机)。

这取决于过滤的复杂性。如果您所做的只是显示结果,例如产品的价格大于 10 美元,那么速度肯定会快得多。如果您要进行复杂的搜索,那么在服务器端处理可能会更快。另一个问题是为每个产品保存多少数据 - 预加载数百个具有大量数据的产品可能需要一些时间。

与往常一样,真正能够回答这个问题的唯一方法是分析这两个解决方案。

If you need to filter the data "very fast" then I imagine the best way is to preload all the data then manipulate it client side. If you're waiting for an Ajax response every time the user needs to filter the data then it's not going to be as fast as filtering it on the client (assuming they haven't got an ancient computer running IE6).

It would depend on the complexity of your filtering. If all your doing is showing results where, for example, the product's price is greater than $10, then that will definitely be much faster. If you're going to be doing complex searches then it's possible that it could be faster to process serverside. The other question is how much data is saved for each product - preloading a few hundred products with a lot of data may take some time.

As always, the only way you'll truly be able to answer this question is by profiling the two solutions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文