DataTables / DataTables/Plugins
More then one pagination for one table break 'input pagination plugin'
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
If you try to use more then one pagination (at top and bottom of table) with 'dom':
dom: '<"top"lp<"clear">>rt<"bottom"ip<"clear">>',
It makes 'input pagination' plugin ( https://github.com/DataTables/Plugins/blob/master/pagination/input.js ) work weird. When you click on bottom of site 'Last', it disables button 'Last', but only in bottom paginator!
I made fast fix for it. I replaced all:
$(xx).removeClass...
$(xx).addClass..
with:
getElementsBySameClassNames(xx).removeClass...
getElementsBySameClassNames(xx).addClass..
My function:
var getElementsBySameClassNames = function(element)
{
if(element.className != '')
{
var jQueryClassesSelector = '.' + element.className.split(/\s+/).join('.');
return $(element).closest('.dataTables_wrapper').find(jQueryClassesSelector);
}
else
{
console.error('Tried to get all elements by same classNames with no className.');
return $();
}
}
Also removed part of code that give 'id's to elements.
I hope you can make it better and release soon.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pagination/input.js, linked from the issue, and reproduce the behavior using two paginators in the shown dom configuration. Trace how the plugin updates pagination controls and verify that clicking Last at either position updates both paginators consistently, including their disabled state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100