Add Drop-down list in Table View

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
xbox2007
Veteran Member
Posts: 129
Joined: 2016-12-16 16:49

Add Drop-down list in Table View

Post by xbox2007 » 2022-02-24 15:38

hello

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 ).
1.png
1
1.png (33.41 KiB) Viewed 1259 times
in normal view , we can see like this:
Screenshot 2022-02-24 at 18-15-07 New Table 1.png
3
Screenshot 2022-02-24 at 18-15-07 New Table 1.png (28.39 KiB) Viewed 1259 times
after Add Drop-down list we can see like this:
Screenshot 2022-02-24 at 18-14-36 New Table 1.png
2
Screenshot 2022-02-24 at 18-14-36 New Table 1.png (33.05 KiB) Viewed 1259 times
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;
	}
3- Edit templates/table1_templateTV_custom.html

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>
4- i create new folder name report and create new file name New_Action.php

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");	
	}

?>
i hope its nice test .. i wish get notes if there are in wrong in my test example.

see all in next topic : How to edit information in Table View
Screenshot 2022-02-24 at 18-34-18 New App الاصناف المطلوبه.png
4
Screenshot 2022-02-24 at 18-34-18 New App الاصناف المطلوبه.png (35.88 KiB) Viewed 1259 times

amyat
Veteran Member
Posts: 45
Joined: 2020-06-24 20:39

Re: Add Drop-down list in Table View

Post by amyat » 2022-03-23 13:41

This worked perfectly. Thank you.
Can't wait your next topic

Post Reply