Pass table id to custom pagination

Pass table id to custom pagination

kubiixkubiix Posts: 5Questions: 0Answers: 0
edited May 2011 in General
I have made a custom digg-style pagination plugin. In fnUpdate I alter the previous page and next page buttons, so they are disabled, when the table is on first or last page. The first approach was using id selector in jquery, but now I want to make the plugin universal and usablewith more tables on one page.

Is it possible to pass the calling table id to the fnUpdate function co I can modify

[code] if (iCurrentPage == 1) {
$('#userlist_previous').addClass("button_disabled");
}
else {
$('#userlist_previous').removeClass("button_disabled");
}
if (iCurrentPage == iPages) {
$('#userlist_next').addClass("button_disabled");
}
else {
$('#userlist_next').removeClass("button_disabled");
}[/code]

to

[code]
if (iCurrentPage == 1) {
$('#' + tableId + '_previous').addClass("button_disabled");
}
else {
$('#' + tableId + '_previous').removeClass("button_disabled");
}
if (iCurrentPage == iPages) {
$('#' + tableId + '_next').addClass("button_disabled");
}
else {
$('#' + tableId + '_next').removeClass("button_disabled");
}
[/code]

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    The table node is available in oSettings which is passed in as the first parameter to fnUpdate, as the parameter 'nTable' (so oSettings.nTable.id will give you the id).

    Allan
  • kubiixkubiix Posts: 5Questions: 0Answers: 0
    Thanks, works great

    the pagination plugin is here - http://pastebin.com/Wdk2p6xw
This discussion has been closed.