question about scrolling datatable with page up/down
question about scrolling datatable with page up/down
visceralist
Posts: 33Questions: 0Answers: 0
Hi.
I am wanting to see how I can configure the datatable so that it listens to the pageup/down event and scroll the datable accordingly? currently, my datatable ScrollY is set to 400px: I am able to scroll the content of the datatable using the mouse wheel if the mouse is over the datatable area; or use the page up/down buttons to scroll accordingly if I click inside the datatable, setting focus to that area first before those buttons scroll the content up and down.
instead I need to be able to hit the page up/down anytime in the page containing the datable and have it scroll the content up/down.
suggestions?
thank you,
I am wanting to see how I can configure the datatable so that it listens to the pageup/down event and scroll the datable accordingly? currently, my datatable ScrollY is set to 400px: I am able to scroll the content of the datatable using the mouse wheel if the mouse is over the datatable area; or use the page up/down buttons to scroll accordingly if I click inside the datatable, setting focus to that area first before those buttons scroll the content up and down.
instead I need to be able to hit the page up/down anytime in the page containing the datable and have it scroll the content up/down.
suggestions?
thank you,
This discussion has been closed.
Replies
Allan
thanks for your response and yes I knew it was going to be pure jquery and I pretty much have the part of the event listener covered; what I don't know however is what datatable function or command to call for each of those two listeners; do you have a code snippet for what to call in my listener to make the table scroll up or down?
thanks,
Allan
$(".dataTables_scrollBody").scrollTop();
I don't think I've got the syntax right on my keypress listener :(
$('#data-table_wrapper').animate({ scrollTop: '0px' }, 800);
You mentioned $(".dataTables_scrollBody") before. Are you adding the id?
Sorry, but we really need a test case to be able to help. I don't have time at the moment to create one myself I'm afraid.
here's a visual representation of the page that contains the datatable
[code]
//main page container
//datatable beings here
500 products
//datatable ends here
//main page ends here
[/code]
it's that datatable that is housed inside the page I want to be able to scroll up/down when keypress happens inside the main page.
thanks,
[code]
$(".dataTables_scrollBody").scrollTop( 50 );
[/code]
Obviously the `50` would be calculated, but that's just an example.
Allan
all that does is nudge the scrollbar up and down briefly and returns back to where it was - at the top of the scrollbar / top of the table :(
[quote]allan said: Obviously the 50 would be calculated, but that's just an example.[/quote]