TACTIC Open Source
MultiSelectWdg behavior - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: MultiSelectWdg behavior (/showthread.php?tid=204)



MultiSelectWdg behavior - maxcom - 03-05-2021

Hi,

which kind of value does the MultiSelectWdg widget return?

I have a sobject column of type text that I'd like to fill with a comma separated list of selected values, but I just get back a string with only the first item selected, the other are just ignored.

Am I missing something?

Should I set my sobject column to a particular data type that can receive multiple selections?


Cheers,
Max


RE: MultiSelectWdg behavior - dankitchen - 03-09-2021

Hi Max,
Are you using the MultiSelectWdg in a standard column edit or are you using it in a custom form (CustomLayoutWdg)? Overall I would think that it should be fine to have the data stored in a test column. I tried on my end thinking it was that maybe the action (MultiDatabaseAction) wasn't in place but it seems to be the same behaviour for me in that it only saves the first value selected.

I dug a little deeprer at the MultiDatabaseAction in the code and the description says:

'''Stores the value in the database as a || separated list. There is also a || at the beginning and end so that the full string can be searched up.'''

So technically it should be saving as "value1||value2" so not sure why it doesn't seem to work at the moment. I am testing on Tactic 4.8 for reference sake.

Have a great night!
-Dan


RE: MultiSelectWdg behavior - maxcom - 03-09-2021

Hi Dan,

thanks for your reply. 

Actually I'm trying to customize the standard Edit Form that pops up when you add a new sobject of a particular sType. (Tactic 4.8)

I have a trigger that fires on insert which configures some sobject data just after its creation. 
In this trigger, when I log what is inside the 'self.input' dictionary for the string data that should get the resulting multiselecion values, I only get the first value that was selected in the form.

I've also found something about the || string separator, but it doesn't seem to work on my side. 

I'm relatively new to tactic widget customization, and I don't know if it is possible to customize/override the behavior of the submit button of the edit form to get around this issue...

Best,
Max


RE: MultiSelectWdg behavior - listy - 03-09-2021

(03-09-2021, 08:55 AM)maxcom Wrote: I have a trigger that fires on insert which configures some sobject data just after its creation. 
In this trigger, when I log what is inside the 'self.input' dictionary for the string data that should get the resulting multiselecion values, I only get the first value that was selected in the form.
May be there is another solution to this problem. Can you make some more screenshots, or visualize results you want to achieve


RE: MultiSelectWdg behavior - maxcom - 03-09-2021

Hi Listy,

thanks for the reply.

Maybe a possible solution could be to delegate the multi selection management to another window. 
I could add a button to the Edit Form that pops up a new modal window, get all the options there, and submit back the result to the Edit Form widget...

The problem is that I don't know if this is possible with tactic's Edit Forms and, even worse, I don't know where to start and how to code a custom pop up widget with submit action in tactic  Sad 

Max


RE: MultiSelectWdg behavior - Diego - 03-09-2021

I checked the source code.
The MultiSelectWdg widget is defined in src/pyasm/widget/input_wdg.py

[REMOVED WRONG INFORMATION]


RE: MultiSelectWdg behavior - Diego - 03-11-2021

Forget my last message, I think I found how to make the MultiSelectWdg work.

Just modify "src/pyasm/widget/input_wdg.py"
and add:
self.set_attr("spt_is_multiple", "true")
in method init() after line 1672

I'm going to send a PR to add it.


RE: MultiSelectWdg behavior - dankitchen - 03-11-2021

(03-09-2021, 08:55 AM)maxcom Wrote: Hi Dan,

thanks for your reply. 

Actually I'm trying to customize the standard Edit Form that pops up when you add a new sobject of a particular sType. (Tactic 4.8)

I have a trigger that fires on insert which configures some sobject data just after its creation. 
In this trigger, when I log what is inside the 'self.input' dictionary for the string data that should get the resulting multiselecion values, I only get the first value that was selected in the form.

I've also found something about the || string separator, but it doesn't seem to work on my side. 

I'm relatively new to tactic widget customization, and I don't know if it is possible to customize/override the behavior of the submit button of the edit form to get around this issue...

Best,
Max
Hey Max, If you look into the Custom Layouts, it can be a much better way to develop a custom form.  You would even be able to just have your own checkbox widgets for multiselect. I mentioned in another post that there may be a need for more documentation as there is a ton of things that can be done via Custom Layouts.  There is some documentation that covers a bunch of what it can do

http://community.southpawtech.com/docs/developer/custom-layout-editor/

A few things have changed since this doc was created, For example, the behaviors are simpler in that you just assign to a class then choose the event.  In the doc is shows having to declare this in the behavior tag.  Also, a bunch of the Mako stuff is simpler.  For example, you can generate a bunch of HTML in the python tab then your variable becomes available in the html via ${variable_name} syntax. 

The doc does cover that the spt.get_input_values(el); function which will grab the data based on any element tags name attribute.  You can also have this function grab from any input element by adding a name attribute and class="spt_input"


RE: MultiSelectWdg behavior - maxcom - 03-12-2021

Ciao Diego,
thank you for the very quick fix!

(03-11-2021, 09:46 PM)dankitchen Wrote: Hey Max, If you look into the Custom Layouts, it can be a much better way to develop a custom form.  You would even be able to just have your own checkbox widgets for multiselect. I mentioned in another post that there may be a need for more documentation as there is a ton of things that can be done via Custom Layouts.  There is some documentation that covers a bunch of what it can do

http://community.southpawtech.com/docs/developer/custom-layout-editor/

A few things have changed since this doc was created, For example, the behaviors are simpler in that you just assign to a class then choose the event.  In the doc is shows having to declare this in the behavior tag.  Also, a bunch of the Mako stuff is simpler.  For example, you can generate a bunch of HTML in the python tab then your variable becomes available in the html via ${variable_name} syntax. 

The doc does cover that the spt.get_input_values(el); function which will grab the data based on any element tags name attribute.  You can also have this function grab from any input element by adding a name attribute and class="spt_input"

Hi Dan, 

at the moment I'm relying only on python for devoloping custom widgets, but Custom Layouts sound more flexible.
I'll definitely have a look at them.

Thank you!
Max