Page 1 of 1

A working multiple-choices lookup (illimited choices from another table)

Posted: 2016-12-09 19:45
by samrainbow
Hello everybody,

I've managed (not without what we could call "hard efforts"...) to make a working multiple-choices lookup.
Within a certain field in Detail-view, you can easily pick up as many choices as you want from another table using the select2 component.
In the Table-view, all the selected choices for the multiple-choices field are listed for each row.
Currently, the quick-search is supported but no filter can be applied on the "multiple-choices" field nor even combined with one or many other filters working on the other fields.



Image

Made with AppGini v5.51

You can test it (add and edit your own records) at the following URL :

http://recoin.org/testdb/
Username : testuser
Password : 123456

Enjoy !

Re: A working multiple-choices lookup (illimited choices from another table)

Posted: 2016-12-14 10:08
by yaroing
Yes!
Exactly what I am looking for. How do You procede in order to make it?

Très intéressant comme outil.

Re: A working multiple-choices lookup (illimited choices from another table)

Posted: 2017-01-14 08:13
by hpiedcoq
I'm also very interested by this hook.

Could you share your code somehow, please?

Thanks

Re: A working multiple-choices lookup (illimited choices from another table)

Posted: 2017-01-30 01:14
by landinialejandro
Hello, I wrote the following code in:
tablename_dml.php

Code: Select all

	// combobox: TAG (TAG is the name field in the tablename)
	$combo_TAG = new Combo;
	$combo_TAG->ListType = 3;
	$combo_TAG->MultipleSeparator = ', ';
	$combo_TAG->ListBoxHeight = 10;
	$combo_TAG->RadiosPerLine = 1;
	if(is_file(dirname(__FILE__).'/hooks/Materiales.TAG.csv')){
	
	// I create the file Materiales.TAG.csv in the hook folder to activate this part of code and coment part of orginal code
//		$TAG_data = addslashes(implode('', @file(dirname(__FILE__).'/hooks/Materiales.TAG.csv')));
//		$combo_TAG->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions($TAG_data)));

// this is the added part
                $res = sql("SELECT Nombre FROM Categorias", $eo);
                while($row = db_fetch_array($res))
                {
                    $inspector[] = $row['Nombre'];
                }
                $combo_TAG->ListItem = $inspector;

// to here
		$combo_TAG->ListData = $combo_TAG->ListItem;
	}else{
		$combo_TAG->ListItem = explode('||', entitiesToUTF8(convertLegacyOptions("A;;B;;C;;D;;E;;"))); // this is the original list of elements
		$combo_TAG->ListData = $combo_TAG->ListItem;
	}
	$combo_TAG->SelectName = 'TAG';
:| the code work fine but i don´t know if is correct.

:( Problem: the code is not in a hook file therewere is erased when compile again

thanks
Alejandro

Re: A working multiple-choices lookup (illimited choices from another table)

Posted: 2017-07-26 03:24
by dilitimor
@samrainbow as I digging detail on your page there is get_tags.php file that call in the json script part
So is not just using the select2 component