etwoss wrote:Hi
Thanks, this is working fine, it ther any way to still use the ID field (so not only have a description but also an ID) so i can use datalink to the ID.
Eric
Please check the JQueryDemoV3_IWXX demo there are some examples in the CJJQDropdown Frame where can take idea from.
In this case there is a way to add not only a description:
- Code: Select all
JSonObjArr:= TSuperObject.Create(stArray);
JSonObj:= SO();
JSonObj.S['id']:= 'CA';
JSonObj.S['text']:= 'California';
JSonObjArr.AsArray.Add(JSonObj);
JSonObj:= SO();
JSonObj.S['id']:= 'MA';
JSonObj.S['text']:= 'Massachusetts';
JSonObjArr.AsArray.Add(JSonObj);
So, reading the component documentation and jquery plugin documentation maybe this can work using the example on previous reply:
- Code: Select all
...
...
while not ADOQuery.Eof do
begin
ItemJSon:= SO();
ItemJSon.S['value']:= ADOQuery.FieldByName('IdFieldName').asString; //here you store the ID
ItemJSon.S['label']:= ADOQuery.FieldByName('DescriptionFieldName').asString; //here you store the Description Value
ItemJSon.S['text']:= ADOQuery.FieldByName('DescriptionFieldName').asString; ///this optional and dont know really what that is for :D but try to assign the same value as you do for 'label'
AJSon.AsArray.Add(ItemJSon);
ADOQuery.Next;
end;
...
...
Also there is an event named OnDataLinkFilterDataSet, where you can asisgn the filter to the List dataset, so maybe that can be a better option with less code.
@Alex Bulei: can you modify the demo so it can show the way how to use the 'value','label' and 'text' items? It can be didactical