CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

which checkbox was clicked in a checkboxlist

by yocko » 20 Mar 2017 20:47

Hi

I am evaluating your product. So far I am impressed :)

I have some problems though. I couldn't find explantion or demo how to find out which checkbox was clicked in a checkboxlist.

Thanks in advance for your help.

yocko
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 21 Mar 2017 12:18

Hi yocko,

You should use the OnClick event, and at this moment, you must create the BrowserParams on this event:

delphi code
procedure TIWForm1.IWCGAppFormCreate(Sender: TObject);
begin
with IWCGJQCheckBoxList1.JQCheckBoxListOptions.OnClick.BrowserParams.Add do
begin
ServerName:= 'checked';
BrowserScript:= 'ui.checked';
end;
with IWCGJQCheckBoxList1.JQCheckBoxListOptions.OnClick.BrowserParams.Add do
begin
ServerName:= 'value';
BrowserScript:= 'ui.value';
end;
end;


Then, on event:

delphi code
procedure TIWForm1.IWCGJQCheckBoxList1JQCheckBoxListOptionsClick(Sender: TObject; AParams: TStringList);
var
LCheckedVal: string;
begin
LCheckedVal:= AParams.Values['value'];
end;


To help the developer, we will add the BrowserParams by default on next beta build.

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 yocko » 21 Mar 2017 15:22

Hi Alexander

thanks for quick response.

And what should I add in your code to save the item's index and/or caption (not only value)? Is that possible?

Can I as a programmer prevent checking/unchecking some item (not with disabling it)? Let's say for example at least one item among enabled items should always remain checked.

Sorry if this task is trivial, but at the present state of knowing your components it isn't trivial for me... But I am enjoying experimenting with them, they are so much more powerful as TMS.

Thanks in advance for your answer.
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27

by Alexander Bulei » 21 Mar 2017 16:52

Hi

And what should I add in your code to save the item's index and/or caption (not only value)? Is that possible?


You can get the item, in server side by value, since the value must be unique.

Can I as a programmer prevent checking/unchecking some item (not with disabling it)? Let's say for example at least one item among enabled items should always remain checked.


Yes, you can, but require some javascript/jquery skills..

here you have the simple example:

javascript code
function (event, ui){
if (ui.value == 'op1'){
return false;
}
}


Put this code in OnClick.Script property.

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 yocko » 21 Mar 2017 18:25

Thanks. I really appreciate your help.
yocko
 
Posts: 28
Joined: 12 Mar 2017 19:27


Return to JQCheckBoxList

cron

Who is online

Users browsing this forum: No registered users and 0 guests

Contact Us.