update dropdown list after produce

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
sueirna
Posts: 9
Joined: 2014-02-06 23:59

update dropdown list after produce

Post by sueirna » 2016-01-19 02:19

hi, how to update/add more list dropdown list after produce?

peebee
AppGini Super Hero
AppGini Super Hero
Posts: 352
Joined: 2013-03-21 04:37

Re: update dropdown list after produce

Post by peebee » 2016-01-19 04:56

You can do it one of a few ways:

The basic way:
(1) add the new dropdown list options to your Appgini project and regenerate your files. Then replace all of the old files with all of the new files

or

Replace the one individual file way:
(2) add the new dropdown list options to your Appgini project and regenerate your files. Then replace just the one file that is actually affected by the change: yourtablename_dml.php (of course you need to change yourtablename to the actual table name that has been edited).

or

Edit just the one existing file:
(3) If you do not want to regenerate your entire project again, you can open yourtablename_dml.php and find the lines that look something like this (this is using Appgini V5.50):

Code: Select all

// combobox: yourfieldname
	$combo_yourfieldname = new Combo;
	$combo_yourfieldname->ListType = 0;
	$combo_yourfieldname->MultipleSeparator = ', ';
	$combo_yourfieldname->ListBoxHeight = 10;
	$combo_yourfieldname->RadiosPerLine = 1;
	if(is_file(dirname(__FILE__).'/hooks/yourtablename.yourfieldname.csv')){
		$yourfieldname_data = addslashes(implode('', @file(dirname(__FILE__).'/hooks/yourtablename.yourfieldname.csv')));
		$combo_yourfieldname->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions($yourfieldname_data)));
		$combo_yourfieldname->ListData = $combo_contype->ListItem;
	}else{
		$combo_yourfieldname->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("OPTION1;;OPTION2;;OPTION3;;OPTION4")));
		$combo_yourfieldname->ListData = $combo_yourfieldname->ListItem;
	}
	$combo_yourfieldname->SelectName = 'yourfieldname';
then edit the line:

Code: Select all

$combo_yourfieldname->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("OPTION1;;OPTION2;;OPTION3;;OPTION4")));
to add your additional dropdown options:

Code: Select all

$combo_yourfieldname->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("OPTION1;;OPTION2;;OPTION3;;OPTION4;;OPTION5;;OPTION6")));
You should of course replace yourtablename, yourfieldname and OPTION1, etc with your own table, field and option names.

That should work for you

Post Reply