使用jquery分页插件

发布于 2024-10-08 13:23:52 字数 710 浏览 1 评论 0原文

我想使用这个插件,但我不知道它是否能满足我的所有需求要求。

我知道我必须使用 JSON 从服务器获取数据,然后在客户端使用它,对吗?现在,这很好,因为我只有很少的记录,但是当我有数千条时;一次性把所有数据都带过来方便吗?我想知道的是:

  • 有什么办法可以查询 每次我按数据库 特定页码?我问 我认为这不是一个好的原因 一次性加载所有数据的想法, 是吗?
  • 我曾经传递记录的id 本来要这样编辑

 <td align="center">
       <c:url value="edititem.htm" var="url">
              <c:param name="id" value="${item.id}"/>
       </c:url>
       <a href="<c:out value="${url}"/>"><img src="images/edit.png" width="14" height="14" alt="edit"/></a>
  </td>

但现在我不知道该怎么做。

我真的希望你能帮助我。

提前致谢。

I want to use this plugin, but I don't know if it'll meet all of my requirements.

I know I have to use JSON to fetch the data from the server and then use it at the client side, is that right?. For now, that's fine, because I only have very few records, but when I have thousands of ; will it be convenient to bring all the data at once? What I would like to know is :

  • Is there any way to query the
    database every time I press the
    number of an specific page? I ask
    this cause I don't think is a good
    idea to load all the data in one go,
    is it?
  • I used to pass the id of the record I
    was going to edit like this

:

 <td align="center">
       <c:url value="edititem.htm" var="url">
              <c:param name="id" value="${item.id}"/>
       </c:url>
       <a href="<c:out value="${url}"/>"><img src="images/edit.png" width="14" height="14" alt="edit"/></a>
  </td>

but now I don't know not how to do it.

I really hope you can help me out.

Thanks in advance.

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

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

发布评论

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

评论(1

绅士风度i 2024-10-15 13:23:52

...我会尝试一下。这个怎么样?如果您查看演示页面的源代码,会发现有一个 member.js 文件,我认为这是演示的模拟数据。我有一个由插件使用的单变量“成员”。所以你是对的,ajax 调用就是你从服务器获取数据的方式。就我个人而言,我认为这很糟糕,因为它都是硬编码的:-(

来自文档:

回调
当用户单击分页链接时调用的回调函数。该函数接收两个参数:新页面索引和分页容器(DOM 元素)。如果回调返回 false,则事件传播停止。默认值:function(){return false;}。该回调函数对于分页功能至关重要!它应该包含更新您的内容的代码。为了获得快速的用户体验,您不应在此函数中通过 AJAX 加载内容。相反,预加载一些内容页面并使用此功能在它们之间切换。

...不过有两句话是个问题:

为了获得快速的用户体验,您不应在此函数中通过 AJAX 加载内容。相反,预加载一些内容页面并使用此功能在它们之间切换。

...在某些情况下,预加载内容可能无法启动,从而违背了使用分页的目的:-(因此您将自己滚动回调函数来获取数据集。

您是否尝试联系作者了解服务器端的信息交互样本?

... I'll give it a shot. How about this? If you look at the source of the demo page, there's a member.js file and I think that's the mock data for the demo. I has a one variable 'members' that's used by the plugin. So you're right, an ajax call would be how you need to get your data from the server. Personally I think that's a bummer since it's all hard coded :-(

From the documentation:

CALLBACK
A callback function that is called when a user clicks on a pagination link. The function receives two parameters: the new page index and the pagination container (a DOM element). If the callback returns false, the event propagation is stopped. Default value: function(){return false;}. This callback function is essential for the functionality of the pagination! It should contain code that updates your content. For a fast user experience you should NOT load content via AJAX in this function. Instead, pre-load some content pages and switch between them with this function.

... 2 sentences are a problem though:

For a fast user experience you should NOT load content via AJAX in this function. Instead, pre-load some content pages and switch between them with this function.

... pre loading content might be a non starter in some situations, defeating the purpose of using pagination :-( So you wold be on your own rolling the callback function to get the data sets.

Did you try contacting the author about server side interaction samples?

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