Page 1 of 1

which checkbox was clicked in a checkboxlist

PostPosted: 20 Mar 2017 20:47
by yocko
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

Re: which checkbox was clicked in a checkboxlist

PostPosted: 21 Mar 2017 12:18
by Alexander Bulei
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.

Re: which checkbox was clicked in a checkboxlist

PostPosted: 21 Mar 2017 15:22
by yocko
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.

Re: which checkbox was clicked in a checkboxlist

PostPosted: 21 Mar 2017 16:52
by Alexander Bulei
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.

Re: which checkbox was clicked in a checkboxlist

PostPosted: 21 Mar 2017 18:25
by yocko
Thanks. I really appreciate your help.