CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

SelectedIndex

by etwoss » 06 Aug 2014 11:21

Hi

if i have fílled the combo with

Code: Select all
IWCGJQComboBoxEx1.JQComboBoxExOptions.AddOption('TEST1', '123');
IWCGJQComboBoxEx1.JQComboBoxExOptions.AddOption('TEST2', '456');


I would like to set the selected index to be 2 because i know my value is '456'.
So i searched in the documentation for a method but can't find it.
Also no method to iterate through the Added options.

is there any way i have not seen to set the selected Index when you only know the value?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Alexander Bulei » 06 Aug 2014 11:34

Hi Eric,

So i searched in the documentation for a method but can't find it.


You should look better in documentation.

http://www.cgdevtools.com/docs/_html/IWCGJQComboBox.TIWCGJQComboBoxExItems.htm

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by etwoss » 06 Aug 2014 11:40

Hi

Should this work?

Code: Select all
  Item:= IWCGJQComboBoxEx1.Items.ItemsByValue['456'];

   if Assigned(Item) then
    IWCGJQComboBoxEx1.SelectedIndex := Item.Index;


With me item is not Assigned

IWCGJQComboBoxEx1.Items.Count = 0

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 06 Aug 2014 11:46

Hi

Found in sourcecode (not in online documentation) :

Code: Select all
 IWCGJQComboBoxEx1.SelectByValue('TEST2');


This works

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 06 Aug 2014 11:48

Hi Eric

The AddOption method since is in the options class, it's client API, only adds in browser, you should add to Items normally, if you want use them.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 06 Aug 2014 12:11

Hi

Thanks, tested and found working!

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58


Return to JQComboBoxEx

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.