0

I have a database with field name

Name, Class, April, May, March, June, July

I would like to show the field name of the database in the datatable view dynamically instead of entering it manually, like this:

<tr>
    <th class="cust_th_01">#</th>
    <th class="cust_th_02">Class</th>
    <th class="cust_th_03">April</th>
    <th class="cust_th_04">May</th>
    <!--<th class="cust_th_07">June</th>
    <th class="cust_th_08">July</th>-->
</tr>

Is it possible, if so how?

azibom
  • 1,769
  • 1
  • 7
  • 21
Sanjana Nair
  • 2,663
  • 6
  • 26
  • 44
  • how you get your database? and display data? – Frenchy Apr 04 '21 at 13:23
  • You can do an extra Ajax request to fetch the headers. But I don’t know what it should be good for – Thallius Apr 04 '21 at 14:12
  • Does this answer your question? [Datatables - dynamic columns](https://stackoverflow.com/questions/37070552/datatables-dynamic-columns). Or possibly [this](https://stackoverflow.com/questions/36046139/datatables-dynamic-columns-from-ajax-data-source), or [this](https://stackoverflow.com/questions/28140671/datatables-with-dynamic-columns) or other similar questions. Those should give you some approaches. Otherwise, you may need to clarify your question. – andrewJames Apr 04 '21 at 14:34

0 Answers0