Page 1 of 1

Specify default option in showSelectDialog?

PostPosted: Fri Mar 24, 2006 11:14 pm
by amisle
Is it possible to specify a default option (which option is selected) in the showSelectDialog method of the dialogs plugin? I have a long list of things, and I would like to default to the one the user selected the last time the dialog was displayed.

If this functionality doesn't exist, could I convince you to add it? :)

PostPosted: Sat Mar 25, 2006 4:00 pm
by IT2Be
The progress plugin (sorry about the name but it comes from a different direction) has alternative dialogs to those of Servoy http://www.it2be.com/plugins.htm#progress.

I can quite easily add an opion to the select dialog in the end that is the default value.

Please let me know...

PostPosted: Mon Mar 27, 2006 1:53 pm
by david
Code to put the last selection as the default followed by a line and then the original list:

Code: Select all
var defaultList = new Array("Value 1", "Value 2", "Value 3")

if (globals.selected) {
   defaultList.unshift(globals.selected, "-")
}

//show select,returns nothing when canceled
var selectedValue = plugins.dialogs.showSelectDialog('Select','please select a name', defaultList);

globals.selected = selectedValue

Re:

PostPosted: Wed Jul 08, 2009 6:20 pm
by rafig
david wrote:Code to put the last selection as the default followed by a line and then the original list:


Hi David,
I know it was years ago you posted this, but needed solution today, found this, works great, THANKS! :D

Rafi

Re: Specify default option in showSelectDialog?

PostPosted: Wed Jul 08, 2009 9:19 pm
by david
Very cool :)

Re: Specify default option in showSelectDialog?

PostPosted: Mon May 10, 2021 1:05 pm
by zoegeurts
It seems that showSelectDialog no longer shows the first option from the list as default option with NG in my case..
It's just a blank, but clicking it still shows the list of options. Could this be due to NG or is it an option somewhere?