Page 1 of 1

SelectedIndex

PostPosted: 06 Aug 2014 11:21
by etwoss
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

Re: SelectedIndex

PostPosted: 06 Aug 2014 11:34
by Alexander Bulei
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.

Re: SelectedIndex

PostPosted: 06 Aug 2014 11:40
by etwoss
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

Re: SelectedIndex

PostPosted: 06 Aug 2014 11:46
by etwoss
Hi

Found in sourcecode (not in online documentation) :

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


This works

Eric

Re: SelectedIndex

PostPosted: 06 Aug 2014 11:48
by Jorge Sousa
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.

Re: SelectedIndex

PostPosted: 06 Aug 2014 12:11
by etwoss
Hi

Thanks, tested and found working!

Eric