Welcome! Log In Create A New Profile

Advanced

[WB24] Checkbox in a Table Control

Posted by DarrenF 
[WB24] Checkbox in a Table Control
February 10, 2020 12:15AM
Hi Guys,

Calling all devs that have added a checkbox to a Table control in WB and managed to get it to work. This is yet another seemingly simple problem that I thought was going to be a breeze, but is turning out to be very frustrating!

I have an Ajax Table control on a page which is populated by an existing project Query - all working fine. I needed to add a Checkbox, so I added it as editable and set all the other columns as read only as per the online Help (extract below).

Why Oh why, when I click on the Checkbox does the tick flash up in the Checkbox then disappear? Then if I click the same Checkbox again a second later does the tick appear and remain there? This is the case for any of the Checkboxes in that Table column that I click on.

I've tried various editable, read-only, no selection options etc... and I can't bind the Checkbox to a variable as the Table is being populated by a query, so thinking it may be a data persistence problem on the server, I even tried adding a field (as described in the Help), to the data file in question and returning the new field in the query, then linking the Checkbox to it, but this didn't work either!

What am I doing wrong? I'm flumuxed as to how to get this to work!!! (sorry, that's a UK phrase for "it's confusing the hell out of me"!)

Online help extract:
Quote
Check Box in a Table control
WINDEVWEBDEV - Server codeWindows MobileJava "Check Box" column in a Table control
To allow the check box to be checked (or not) when clicking the "Check Box" column:
The Table control must be in edit.
The "Check Box" column must be in edit mode.
All other columns of Table control must be read-only.
Using a Check Box column in a table:
The following behavior can occur when using a Check Box column in a browsing Table control:
The check boxes of visible rows are checked.
The checkmarks are lost whenever the scrollbar moves.
This behavior indicates that the check box is not linked to a file item.
To manage a check box in a Table control, you must:
create a suitable item (whose type is check box for example) in your data file. In this case, this item can be managed in a browsing Table control.
create a memory Table control.

Check box and databinding
The databinding is available for the Check Box controls under the following conditions:
if the check box has a single option, it must be linked to a simple variable.
if the check box has several options, it must be linked to an array.
If this condition is not respected, a GUI error will be generated.


Regards,
Darren.



Edited 1 time(s). Last edit at 02/10/2020 12:17AM by DarrenF.
Re: [WB24] Checkbox in a Table Control
February 10, 2020 01:12PM
Hi Darren,

The direct access mode for a table in Webdev is very limited, so I always set the table mode to "data loaded in memory" and "put all in browser cache". I use this all the time to let the user select one or more rows of a table, have never had the problems you describe.

Regards,
Piet
Re: [WB24] Checkbox in a Table Control
February 10, 2020 02:57PM
Thanks Piet,

I'll take a look at your suggestion.

Failing that, I might be able to get it working by adding some code to the Row Selection event.

I'll report back if/when I get it working...

Cheers!

Regards,
Darren.
Re: [WB24] Checkbox in a Table Control
February 11, 2020 09:32AM
UPDATE:

I got it working!

Solution: In addition to what I'd already done, all I needed (as Piet suggested), was to set the "Loaded in memory:" radio button on the Content tab of the Table control.

Regards,
Darren.
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: