Possible bug with API for row.child.hide() method?

Possible bug with API for row.child.hide() method?

nalexiounalexiou Posts: 3Questions: 1Answers: 0

Hi everyone. I just started exploring the options of datatables - great stuff!

So here is my issue/question:

I have created a responsive table and I have added a button to clear the filters on the page. The clearing functionality works fine but I then realized that if I had a child row expanded, the table displays the details after the table filters are reset and it's drawn. So, I decided to use the row().child.hide() when checking for row().child.isShown(). So, my code does collapse/hide the details of each row but the icon that toggles that state (circle with +/-) remains unchanged as -. So, to get the row in the correct state I must click on the - icon twice which will then eventually change back to +. Is this a bug or is there an additional step I need to take to toggle that icon as well?

Thank you.
-nick

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin

    Can you link to the page showing the issue, as per the forum rules please?

    Are you trying to use custom show / hide rows + Responsive's own show / hide rows? I suspect that way lies madness as the two would be overwriting what the other has done.

    Allan

  • nalexiounalexiou Posts: 3Questions: 1Answers: 0

    Hi Allan,

    Thank you for getting back to me. My apologies for not posting the page/code.

    You can view the page functionality/issue here: http://lfatest.herokuapp.com/

    My code is here (check line 180 where I call the hide method):

    https://github.com/nalexiou/json_library/blob/childtest/public/myscript.js

    And no, I do not use any custom show/hide rows in this app.

    Thank you for your time and assistance.

    -Nick

  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin
    Answer ✓

    I see - so you are trying to manipulate Responsive's child rows using the DataTables API basically? The button doesn't change because Responsive doesn't know that the child row has been hidden and it is what is in control of the child rows in this case (the button isn't part of DataTables show / hide functionality - it is the external script that controls it, Responsive in this case).

    I would suggest not using the child API methods at all when Responsive is involved since it effectively takes control of them.

    If you aren't getting the behaviour you want (i.e. you want to collapse the child rows on page change) it would likely need a hack in Responsive (listen for the page event) as that isn't a designed feature, sorry.

    Allan

  • nalexiounalexiou Posts: 3Questions: 1Answers: 0

    Thanks Allan for explaining this. What I ended up doing instead of using the child API is trigger a click event for the controlling cell/column for all the children that are shown.

  • allanallan Posts: 63,685Questions: 1Answers: 10,498 Site admin

    That would do it. Good to hear you got a fix.

    Allan

This discussion has been closed.