Page 1 of 2

TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 12:31
by Corwin
HI

I want to use a TIWTGJQComboBoxEx to create a list to choose an item; I take the list from a TBOraQuery.
I connect everything but the combo I do not have any item.
In TIWTGJQComboBoxEx I insert the name of TBOraQuery in Datalink.DataSource and FiledName in the name of the field to display in the combo.
Something is missing?

Regards

P.S.
(if instead use a TIWCGDropDown, everything works)

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 14:07
by Jorge Sousa
Hello

You need to match the several ComboEx.Items[i].Value to the DataSet values, are you doing this?

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 14:14
by Corwin
I did not think it was necessary ... there is an object combo that gets automatically (such as TIWCGDropDown)?

and if I have to enter the values manually of what I need datalink?

otherwise I have to do for the table and enter the individual items? as you insert the key and the description?

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 14:41
by Jorge Sousa
Hi

Yes, only DropDown has items filled by a dataset, because it has ajax loading controlled by a given number of records. We don't want to take the risk to fill the combos with a lot of records.

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 14:45
by Corwin
understand...

1) and if I have to enter the values manually of what I need datalink?

2) that is correct?
Code: Select all
  while not dm.TBOraSepe1.EOF  do
   begin  IWCGJQComboBoxExAzie.Items.AddOption(dm.TBOraSepe1.FieldByName('SEDE_DESCR').AsString,dm.TBOraSepe1.FieldByName('EL').AsString, True);
 dm.TBOraSepe1.Next;
  end;

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 14:53
by Jorge Sousa
Hi again

not quite correct

Value is the key

i would do this,

Code: Select all
var
  Item: TIWCGJQComboBoxExItem;
begin
  dm.TBOraSepe1.First;
  while not dm.TBOraSepe1.EOF do
  begin
    Item:= IWCGJQComboBoxExAzie.Items.Add;
    Item.Value := IntToStr(dm.TBOraSepe1.FieldByName('EL').AsInteger); // ????
    Item.Caption:= dm.TBOraSepe1.FieldByName('SEDE_DESCR').AsString; 
    dm.TBOraSepe1.Next;
  end;
end;


if this is called in an ajax (or async) event, you need to call aditionally

IWCGJQComboBoxExAzie.AjaxReRender

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 15:10
by Corwin
Hi again, Jorge

actually works, thanks ...

but explain to me what is the datalink because I have to do things manually?

regards
Raul

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 15:48
by Jorge Sousa
Hello

In this case, the DataLink only selects the Item / Caption, for the currrent value.

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 15:53
by Corwin
ok ...

last question ..
how to control the selection in the combo box (then I do a query for a combo next connected)? old Delphi had onExit ...

Regards

Re: TIWTGJQComboBoxEx with data from querytable

PostPosted: 29 Apr 2015 16:06
by Jorge Sousa
You will find the suitable event in ComboBoxEx.JQComboBoxExOptions

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