Specify default option in showSelectDialog?

Questions and answers on developing, deploying and using plugins and JavaBeans

Specify default option in showSelectDialog?

Postby amisle » Fri Mar 24, 2006 11:14 pm

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? :)
amisle
 
Posts: 62
Joined: Sun Sep 11, 2005 9:09 pm
Location: Lincoln, NE, USA

Postby IT2Be » Sat Mar 25, 2006 4:00 pm

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...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby david » Mon Mar 27, 2006 1:53 pm

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
Attachments
Picture 8.png
Picture 8.png (13.27 KiB) Viewed 4387 times
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re:

Postby rafig » Wed Jul 08, 2009 6:20 pm

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
Servoy Certified Developer
Image
rafig
 
Posts: 704
Joined: Mon Dec 22, 2003 12:58 pm
Location: Watford, UK

Re: Specify default option in showSelectDialog?

Postby david » Wed Jul 08, 2009 9:19 pm

Very cool :)
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Specify default option in showSelectDialog?

Postby zoegeurts » Mon May 10, 2021 1:05 pm

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?
zoegeurts
 
Posts: 1
Joined: Mon May 10, 2021 11:23 am


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 12 guests