Target li in responsive datatable

Target li in responsive datatable

WebCodexWebCodex Posts: 71Questions: 13Answers: 3
edited January 2019 in Free community support

Hi, I am currently targeting columns in the main table view (not responsive) using the following rowCallback

"rowCallback": function (row, data) {
    checkInStash(exid, data.flavour_name, data.flavour_company_name).done(function(data){ 
        if(data == true) {
               $(row).addClass( 'instash' );
               $(row).find('td:eq(5)').html('<button class="btn btn-primary flavour-stash">Remove From Stash</button>');
                            
        } else {
            $(row).removeClass( 'instash' );
            $(row).find('td:eq(5)').html('<button class="btn btn-primary flavour-stash">Add To Stash</button>');
        }
});

How can I target the li of the responsive table to do the same thing?

You can see the table here: https://vccalc.vapingcommunity.co.uk/flavours

Thanks in advance

Answers

  • WebCodexWebCodex Posts: 71Questions: 13Answers: 3

    @allan Do I need support credits to get help in the forum now? I'm seeing this on the right side of the screen...

    Support
    No support credits remaining. Need help? Top up your support credits here.
    
  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,947

    Do I need support credits to get help in the forum now?

    No. Allan and Colin probably haven't had a chance to look at your post.

    Is this what you are looking for?
    https://datatables.net/extensions/responsive/examples/child-rows/custom-renderer.html

    Kevin

  • WebCodexWebCodex Posts: 71Questions: 13Answers: 3

    No. Allan and Colin probably haven't had a chance to look at your post.

    I wasn't sure, I don't remember seeing that message before. I wasn't expecting a reply straight away, I know they are very busy. Thanks for clarifying.

    Is this what you are looking for?

    If it is, I have no idea how to implement that in my "rowCallback": function

    I thought it would be as easy as finding the next tr and then finding the li but I've tried and tried and got nowhere.

    Thanks for your reply

  • kthorngrenkthorngren Posts: 21,309Questions: 26Answers: 4,947
    edited January 2019

    Don't think the not about support credits is new.

    See if this thread helps:
    https://datatables.net/forums/discussion/comment/142469/#Comment_142469

    Look at the example in the last post. This code is separate from rowCallback.

    Kevin

  • WebCodexWebCodex Posts: 71Questions: 13Answers: 3

    I've removed the responsive aspect from the table until I can come up with a solution, thanks

This discussion has been closed.