Can I use buttons to go to the previous or next row in the modal?

Can I use buttons to go to the previous or next row in the modal?

TeeHillTeeHill Posts: 3Questions: 1Answers: 0
edited October 2022 in Free community support

Link to test case: http://live.datatables.net/qimaxujo/1/edit
Debugger code (debug.datatables.net): NA
Error messages shown: No errors
Description of problem: When using responsive, is it possible to use buttons/links within the modal to navigate to the previous or next row without closing the modal? In the test case provided I have the modal with the chevron icon buttons in the bottom left, but I don't know what to do next. Any advice or assistance would be very appreciated :smile:

Cheers, Tee

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Hi Tee,

    I'm sorry, there is no API for that at the moment. You could perhaps trigger a click event on div.dtr-modal-background and then trigger a click on the row you want to show next - which would work, but you'd also need to keep track of which row is currently shown. Not impossible at all, but it would require a bit of non-library code I suspect.

    There was a discussion a little while ago about making the Responsive modal API callable, which would help, but I think that would actually be the easy part of what you are trying to do.

    Allan

  • TeeHillTeeHill Posts: 3Questions: 1Answers: 0

    Hi Allan,

    Thanks for the response.

    Identifying the row is probably the main issue for me so far as I didn't see any built in way to do this, perhaps I will look to use a row id column that is hidden and use that with your recommendation. I'll keep trying and see what I can come up with!

    Thanks again for the support and great product that Datatables is :smile:

    Cheers, Tee

  • TeeHillTeeHill Posts: 3Questions: 1Answers: 0
    edited October 2022

    Working Case: http://live.datatables.net/qimaxujo/6/edit

    Hi Allan,

    I took on your suggestions and got it working as I wanted :smile: I'm sure my code is a mess but the logic is there for anyone else wanting to achieve a similar task of moving through the rows with buttons / links from within the modal. My working case uses a custom filter but the logic for moving through the rows should work on tables without custom filters!

    All the best, Tee

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Outstanding - nice one. And thank you for sharing your solution with us!

    Allan

Sign In or Register to comment.