data-visible not honored when updating existing rows

data-visible not honored when updating existing rows

cezarcezar Posts: 3Questions: 1Answers: 0

If you update an existing row using var row = $(whatever).find('td'); row.text('newtext); DataTables completely ignores data-visible="false" in <thead>. Has anyone come up with a workaround for this bug?

Replies

  • kthorngrenkthorngren Posts: 20,269Questions: 26Answers: 4,765

    Not sure I understand your problem description. You aren't using Datatables API's to updated the table.

    DataTables completely ignores data-visible="false" in <thead>

    Please provide more details of what you mean. How is it ignored?

    Kevin

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Yup - I'm not quite clear on what is happening either. You can use columns.visible to set the column visibility, and that can be set as a data attribute at initialisation time, but DataTables will not react to changed in the data attributes after initialisation. Use the API instead.

    Allan

  • cezarcezar Posts: 3Questions: 1Answers: 0

    I'm not changing the attributes after initialization. I'm setting them once in the markup and then updating rows through the API

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    That sounds like it should work. If it isn't doing what you expected, I'd be happy to take a look at a test case showing the issue.

    Allan

  • jeroenvo2jeroenvo2 Posts: 1Questions: 0Answers: 0

    Maybe you have saved setting in localstorage (if statesave is on) which overrides the visibility setting.

This discussion has been closed.