Update initialized datatable configs

Update initialized datatable configs

Red SniperRed Sniper Posts: 47Questions: 9Answers: 0

Description of problem:
Sorry for not providing a test case, will do if necessary.

Problem:
I have a datatable with a lot of columns (24) and I cannot display all of them at the same time.
I thought to add some buttons that would automatically hide/show some of these columns, depending on some criteria.
Some of these columns are editable too, and I use dts' options such as keys.editor , keys.editOnFocus and keys.columns to trigger editing when I click on a specific cell of an editable column.

Question:
Since the editable columns specified in keys.columns do change of position (both using an array of indexes or css selectors) when I hide/show em, is there a way to update this option when I change the displayed columns? otherwise editor logs the error 'Uncaught Unable to automatically determine field from source.' if I click on a cell's column that was supposed to be editable (and after the view changes there is one that is not editable)

Thanks for the help!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin
    Answer ✓

    I'm sorry there isn't an API method to update that specific option. Perhaps an alternative though is to add the class "keys" (or whatever) to columns which should be accessable via KeyTable, then you can set keys.columns to .keys.

    Allan

  • Red SniperRed Sniper Posts: 47Questions: 9Answers: 0

    Thanks Allan, I'll give it a look and let you know in case

Sign In or Register to comment.