Two-button pagination still showing text
Two-button pagination still showing text
Ironwil616
Posts: 50Questions: 0Answers: 0
My pagination uses the two buttons, assigned class: paging_two_button. After upgrading to version 1.9.0, I get the buttons but also "Previous" and "Next" text displayed on top of them. If I use a debugging tool, I can see this is the text of the anchor tags the buttons actually are, this is their assigned text values. I can remove it dynamically and then the buttons appear normally. When looking at the last version of datatables and the latest, it appears that the rendered HTML is different. Version 1.9.0 seems to inject two anchor tags into a containing div, while the last version's HTML was two divs inside of the container div - no anchor tags. Does anyone else have this issue?
This discussion has been closed.
Replies
Allan
Allan
Thanks,
Allan
I also tried to use the documentation inside the datatables plugin to modify these values, but didn't have any luck. What I wanted was to remove the "Next" and "Previous" text values, but add them in when using full numbers pagination (otherwise the next and previous buttons are just empty buttons). However, adding this to my init code didn't work:
[code]
"oLanguage": {
"oPaginate": {
"sNext": "Next"
}
}
[/code]
I tried it with variations of only using "oPaginate" and then only "sNext" without the wrapping of their parents in that bit of code, but that didn't work, either. This is a total hack, but what finally worked for me was to leave "sNext" and "sPrevious" as empty strings in the datatables plugin (lines 9169 and 9190 for me), and add this to my datatables init code:
[code]
"fnDrawCallback": function () {
$(".previous").text("Previous");
$(".next").text("Next");
}
[/code]
This works as I want it to, but I have to modify my init calls for each table that will use full numbers for pagination. Bummer. Allan, whenever you have time, could you post an example of how to modify the "sNext" and "sPrevious" values? I just couldn't get that to work.
Heh - and for people that can't see the screen and use a screenreader?
Here is an example showing how to remove the text: http://live.datatables.net/esemen/edit#javascript,html .
@Ironwil616
> I was just reading through the plugin, and oddly the next for "sNext" and "sPrevious" are listed as being used for "full_numbers" type of pagination. However, they're being pulled in and used for "two_button" pagination as well.
Yup - documentation is slightly out of date there. I've just committed the fix and the documentation on the site will be updated with the 1.9.4 release.
Allan
Depends on the screen reader, but typically yes, it will be referenced in one way or another. Working with screen readers and ARIA is like trying to work with browsers and CSS in 1999. Everyone does it utterly differently from everyone else!
Allan