i make small example to show how i Add Drop-down list in Table View .
in my project i have one felid is Drop-down list value (Accept - Deny ).
in normal view , we can see like this:
after Add Drop-down list we can see like this:
this is my steps :
1- save as templates/table1_templateTV.html to templates/table1_templateTV_custom.html
2- add custom link to hooks files table1.php
Code: Select all
function table1_init(&$options, $memberInfo, &$args) {
$options->Template = 'templates/table1_templateTV_custom.html';
return TRUE;
}
Code: Select all
<td id="table1-name-<%%VALUE(id)%%>" class="table1-name text-left"><%%SELECT%%><%%VALUE(name)%%><%%ENDSELECT%%></td>
<td id="table1-date-<%%VALUE(id)%%>" class="table1-date text-left"><%%SELECT%%><%%VALUE(date)%%><%%ENDSELECT%%></td>
<td id="table1-Action-<%%VALUE(id)%%>" class="table1-Action text-left">
<select class="form-control" id="area" name="menu" onChange="top.location.href=this.options[this.selectedIndex].value;" value="GO">
<option disabled selected style="display:none"><%%SELECT%%><%%VALUE(Action)%%><%%ENDSELECT%%></option>
<option id="option-1" value="report\New_Action.php?Status=Accept&ID=<%%VALUE(id)%%>&Act=<%%VALUE(Action)%%>">Accept</option>
<option id="option-2" value="report\New_Action.php?Status=Deny&ID=<%%VALUE(id)%%>">Deny</option>
</select>
</td>
<td id="table1-notes-<%%VALUE(id)%%>" class="table1-notes text-left"><%%SELECT%%><%%VALUE(notes)%%><%%ENDSELECT%%></td>
<td id="table1-xxxxxx-<%%VALUE(id)%%>" class="table1-xxxxxx text-left"><%%SELECT%%><%%VALUE(xxxxxx)%%><%%ENDSELECT%%></td>
Code: Select all
<?php
include("../lib.php");
$filed_ID = intval($_GET['ID']);
$Status = $_GET['Status'];
if(!$filed_ID) exit(error_message('Invalid order ID!', false));
//echo $filed_ID ."--". $Status ;
if($Status=='Accept'){
sql ("update table1 set Action ='Accept' where Id = '{$filed_ID}'", $eo);
header("Location: ../table1_view.php");
}else if ($Status=='Deny'){
//echo $R_Num;
sql ("update table1 set Action ='Deny' where Id = '{$filed_ID}'", $eo);
header("Location: ../table1_view.php");
}
?>
see all in next topic : How to edit information in Table View