datatable - how to make data table heading dynamic in codeigniter -
function list_datatable() { //function initialize data table library $this->datatable_initialize(); //set template table $tmpl = array ('table_open' => '<table id="list_details" class="table table-bordered responsive my_table table-striped">' ); $this->table->set_template($tmpl); //set th heading table $this->table->set_heading('id','name','dob','email','mobile','address','role'); $this->table->set_caption('<colgroup> <col class="con0"> <col class="con1"><col class="con0"> <col class="con1"> <col class="con0"><col class="con1"><col class="con0"> </colgroup>'); }
i want set data table heading dynamically using database query please me find solution
instead of passing individual parameters, set_heading
accept array. can change code to
$this->table->set_heading("", $headingcolumns);
$headingcolumns
array contains column names, can fetch database.
you can find more info here: https://www.codeigniter.com/user_guide/libraries/table.html
Comments
Post a Comment