Modify style of advmultiselect / general question to related records

17 views
Skip to first unread message

Richard Mücke

unread,
Apr 18, 2024, 10:11:06 AMApr 18
to Xataface
Hi,

I try to add existing related records to another table.
When using the relationships.ini I can display the related records and I can add them.
Nice and smooth.

Now I try to modify the list which is displayed when adding a new existing record.
It only shows a list of selectable records.
But I want to show a combination of records to select from - normally you can define this in the valuelists.ini.

But the relationship definiton is not using any valuelists setting.

My explenation is bad. Let me show you some screenshots...:
xat1.png

Here you can see the list of related records with some columns. Very nice. 
Now I want to add another related record and click on "Add..." button up right.

xat2.png
Here you can see that only one column is displayed for selection.
But I want to display a combination of two columns, like:
[voc_kommpartner]
__sql__ = "SELECT id, CONCAT(art, ': ', name) AS FullName FROM h_servicepartner ORDER BY FullName"

I try to achieve this in valuelists.ini - this doesnt work. It seems that the add exsiting related record selection field is build without using any other ini-files?

So I came to the advmultiselect widget.
This - surpreisingly - would work with the vocaublary:
xat3.png

Normally you could see, that the selectable entries are the content defined in the valuelists.ini as shown above.
But you cant see it, because the width of the element is too small.

So I tried to change the width of this element - but I couldnt. I dont know where to change it - except within the originally code of this widget:
File: Dataface/FormTool/advmultiselect.php
I modified it and added the yellow marked line:
class Dataface_FormTool_advmultiselect {
        function &buildWidget(&$record, &$field, &$form, $formFieldName, $new=false){
                $table =& $record->_table;

                $widget =& $field['widget'];
                if ( !@$field['repeat'] ) $field['repeat'] = 1;
                $factory =& Dataface_FormTool::factory();
                $attributes = array('class'=>$widget['class'], 'id'=>$field['name']);
                if ( $field['repeat'] ){
                        $attributes['multiple'] = true;
                        $attributes['size'] = 5;
                        $attributes['style'] = 'width: 300px';
                }

And it works:
xat4.png
The selection boxes are bigger and the lines are readable. 
But... I need to modify the original file - after an update my changes will be lost.

So... I have a couple of questions and would be very happy, if you could help me :)

1. How can I modify the valuelist for the originally add existing related records function as shown in screenshots 1 and 2?

2. How can I change the width of advmultiselect without modifying the original code?

Thanks in advance for your help!

Best regards
Richard
Reply all
Reply to author
Forward
0 new messages