CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

CheckBoxList.Selected not updated if set programatically

by ScottWGast » 07 Sep 2014 16:34

Here is the scenario:

I have a few TIWCGJQCheckBoxList components that I load up with anywhere between 4 and 20 .Items. The Items[x].Selected value is set from data out of a database with LoadSecurityProfiles(), which in turn calls LoadSecurityProfile for each TIWCGJQCheckBoxList component:

Code: Select all
procedure TframeEditSecurityProfile.LoadSecurityProfiles;
begin
  Self.LoadSecurityProfile(C_SECURITY_PROFILE_CASE_FILE, Self.checkListCaseFileOptions);
  Self.LoadSecurityProfile(C_SECURITY_PROFILE_EMAIL, Self.checkListEmailOptions);
end;

procedure TframeEditSecurityProfile.LoadSecurityProfile(SecurityProfileIndex: Integer; CheckBoxList: TIWCGJQCheckBoxList);
var
  strCode, strSecurityCode: String;
  i: Integer;
begin
  strSecurityCode := Self.FADOData.FieldByName('security_code').AsString;
  strCode := S2Snax.GetToken(strSecurityCode,SecurityProfileIndex,';');
  SetLength(strCode, CheckBoxList.Items.Count);
  CheckBoxList.Disable;
  for i := 0 to CheckBoxList.Items.Count - 1 do
    CheckBoxList.Items[i].Selected := (strCode[i+1] = 'Y');
  CheckBoxList.Enable;

end;


After the above code, the check list box displays correctly, with each of the .Items showing checked or not checked as expected.

If I DO NOT click on the checkboxlist to change the checkbox of an .Item, when I run this code:

Code: Select all
function TframeEditSecurityProfile.GetSecurityProfileCode(CheckBoxList: TIWCGJQCheckBoxList): String;
var
  strCode: String;
  i: Integer;
begin
  strCode := '';
  for i := 0 to CheckBoxList.Items.Count - 1 do
    strCode := strCode + S2Snax.Iif(CheckBoxList.Items[i].Selected, 'Y', 'N');
  Result := strCode + ';';
end;


The result from the above function is always a string like 'NNNNNNNNNNNNNNNNNNNN;'

On the other hand, if I DO click on any item in the list to check/uncheck it, the string returned is a correct representation of the items that are checked or unchecked... like 'YYYYYNNNYNNNYYYNYYNY;'

I can, of course, set a variable that will indicate whether or not the user has actually clicked, but it seems like a bug.

Is there a property that I need to set after I load the checkboxlist with .Items so that it will "know" that the LoadSecurityProfile function (above) was executed?

Scratching my head...

Thanks,
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 08 Sep 2014 10:57

Hi Scott

yes, confirmed It's a bug.

To be fixed asap.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 08 Sep 2014 14:07

Thank you sir!

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 09 Sep 2014 14:33

fixed for next release
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by ScottWGast » 09 Sep 2014 15:36

Eggsellent...TYVM!

Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by ScottWGast » 17 Sep 2014 16:40

I've installed v2.3.0.42 and this issue seems to still exist.

What version will this issue be "fixed" in?

Thanks,
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

by Jorge Sousa » 17 Sep 2014 17:27

Hi

Yes we fixed what we believed to be the issue:

2.3.0.41

JQCheckboxList:
- Added: properties AppendTo and Position, to be able to deal with the problem of dialogs.
- Fixed: wasn't synchronizing the values onclick with displayInline

In what event are you checking the selected items, calling GetSecurityProfileCode?

Can you reproduce this issue in a simple test case project?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Jorge Sousa » 17 Sep 2014 17:43

Don't worry about the demo, we were able to reproduce, filling the selects in an ajax event like you're doing in LoadSecurityProfile
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Alexander Bulei » 17 Sep 2014 17:47

Registred Ticket: #SRC00040443
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: 3637
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by ScottWGast » 17 Sep 2014 18:08

Thank you sir!
Scott
ScottWGast
 
Posts: 875
Joined: 23 May 2012 11:02

Next

Return to JQCheckBoxList

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.