show extra / detailed information... How to set default Content

show extra / detailed information... How to set default Content

Pedro MartinsPedro Martins Posts: 22Questions: 11Answers: 0
edited October 2019 in Free community support

Hello every one! Was searching for a way to set a default value for a atribute of my table that is hidden in the show extra / detailed information Button.

i know i can set it like this when it is in a normal Table

$('#example').dataTable( {
  "columns": [
    null,
    null,
    null,
    {
      "data": "first_name", // can be null or undefined
      "defaultContent": "<i>Not set</i>"
    }
  ]
} );

How should i set it for hidden atributes/columns???

Would i be able to hide button if value/atribute that is hidden is Null???

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,214Questions: 1Answers: 10,415 Site admin

    Can you link to an example please? I don't see any code above that shows how you are displaying the details, so I'll need a lot more to go on than the above.

    ALlan

  • Pedro MartinsPedro Martins Posts: 22Questions: 11Answers: 0
    edited October 2019

    Hello @allan !
    i am using this code as a sample...

    http://live.datatables.net/bihawepu/3330/edit

    Would like to put a default text if one of the atributes in the details is null,
    Or even better as i have only one atribute hidden to be able to hide the button if value is null... it´s not worth clicking if there is no extra info!

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    Hi @Pedro Martins ,

    You can use createdRow to remove the '+' sign - see example here. If you look at the third line, the '+' is gone. You could do the same, with extra logic for whatever your criteria is.

    For each individual line, you can modify that in your format() function,

    Cheers,

    Colin

  • inah.younginah.young Posts: 1Questions: 0Answers: 0

    Hi, I'm new in php. I would like to know on how can I fetch the data from the database and display it on the Datatables with show/hide extra detail information.

This discussion has been closed.