SELECT LIVE INPUT
In the table View page add a column for your input. For example NOTES, in this case 300 is a with of 300px
array_push($td_titles, "300-CATEGORY");
Then we need to create an array with the following values, some of them are optional.
"type" is required, this tells that we are going to a live input
"col" is also required to specify the database column name where the content will be fetched from and saved into
"inputType" is also required and it is one of he list above, in this case "text"
"options" is also required and contains an array of all the options and values of the select field
We can create the options manually or dynamically from the database:
Manual:
$sel_options= [ '1'=>'CAT 1', '2'=>'CAT 1', '3'=>'CAT 1', ]
Dynamic:
$cat_ops= $connection->new_query("SELECT CATID, NAME FROM CATEGORIS WHERE visible = 1 order by pos",true); $sel_options= array(); foreach($cat_ops->fetch() as $v){ if($v['val']!=''){ $sel_options[$v['CATID']] = $v['NAME']; } }
Then we insert the array to our $tdvalue array
$tdvalue = array( 'type'=>'live', 'inputType' => 'textarea', 'col'=>'notes', 'options'=>$sel_options 'privilege'=> 4, //optional, 4 will show the field only to High and Admin privileges, default is 1 'class'=>'', //optional, class name selector default: none (empty) 'attribute'=>'' //optional, can be any attribute(s) with value(s) default: none (empty) );
Finally the array is added to the $td_fields array.
array_push($td_fields,$tdvalue);