Paging on urls in data table

Paging on urls in data table

thsiao11thsiao11 Posts: 2Questions: 0Answers: 0

Hi,


Is it possible to configure JQuery.datatables to read a table with a single column of urls and provide pagination function on these urls? For example, if I have a table like this:

<table><tr>
<td>www.apple.com</td>
<td>www.google.com</td>
<td>www.msn.com</td>
...
</tr></table>

Can I set up JQuery.datatables to provide the paging buttons based on the urls in my table above? I do not need to display the urls from the table above in the web page.


Thanks in advance

Replies

  • allanallan Posts: 61,863Questions: 1Answers: 10,135 Site admin

    Yes. But you must add tbody and thead elements, as noted in the requirements.

    Allan

  • thsiao11thsiao11 Posts: 2Questions: 0Answers: 0

    Hi Allan,

    Thanks for your response.

    I am not sure I follow your suggestion. If I can explain my question in a different way. Let's say I have the following JQuery commands:

    $(document).ready(function(){
    $("#page1").click(function(){ $(location).attr('href', 'http://stackoverflow.com') });
    $("#page2").click(function(){ $(location).attr('href', 'http://www.yahoo.com') });
    ...
    });

    Is there a way to use JQuery.datatables' pagination buttons to simulate the behavior of the commands above?

  • kthorngrenkthorngren Posts: 20,378Questions: 26Answers: 4,781

    I'm not clear how you want to use the pagination buttons. They are used for paging to different pages in the table.

    You can create custom buttons using the Buttons extension. These can be used to open the URLs.
    https://datatables.net/extensions/buttons/custom

    Kevin

This discussion has been closed.