开发者

Using jquery pagination plugin

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜