Pass table id to custom pagination
Pass table id to custom pagination
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]
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]
This discussion has been closed.
Replies
Allan
the pagination plugin is here - http://pastebin.com/Wdk2p6xw