very simple q: how to store database id in rows/records?

very simple q: how to store database id in rows/records?

guidoriceguidorice Posts: 8Questions: 4Answers: 1
edited September 2016 in Free community support

Hi all, I am sure this is possible with datatables' rich API, but actually cannot find the answer in the docs or examples :(
I have a column with database primary key (ID). I want to store it for later web api usage, but do not want to display it to the user. What is the easiest way to do this?

This question has an accepted answers - jump to answer

Answers

  • guidoriceguidorice Posts: 8Questions: 4Answers: 1

    Aha- got it figured, at least one way to do it. This works to specify visible false for a column.

    opts.columns = [
        {
          name: 'ID',
          data: 'classification_id',
          visible: false,
          searchable: false
        },
    

    What tripped me up, is apparently I had turned on stateSave: true, and that was somehow preventing the ID column from being hidden.

  • allanallan Posts: 61,439Questions: 1Answers: 10,053 Site admin
    Answer ✓

    is apparently I had turned on stateSave: true, and that was somehow preventing the ID column from being hidden.

    If the columns were previously visible, then yes, that visibility would take priority over the inititlisaiton options.

    Allan

This discussion has been closed.