Hello,
since we needed to add multiple selection to some of our forms (table view), but wanted to use checkboxes insteas of CTRL + click, we tried the following approach:
- add a column to the form’s foundset named ‘checked’ of type INTEGER so we know what records have been selected
- add a field of type CHECK to the table and assign it ‘checked’ as dataprovider
- possibily assign method to the onAction and onDataChange events of checkboxes
- put the form’s controller.readOnly property to false
Now two problems arise, let’s go in order.
First of all, if you assign the onRender method of the check field clicking seems to go crazy altogether. Checkboxes are not selected when you click on them or you need two or three consecutive clicks for them to work correctly. Is that a known issue with the onRender method? We’ve temporary solved this by simply applying the onRender method on single fields rather than on the whole form. Nontheless this seems quite an annoying issue.
Secondly, there’s a problem when searching the modified foundset for selected records. In particular, when the following code is executed
var _fsCopy = foundset.duplicateFoundSet();
if(_fsCopy.find())
{
_fsCopy.checked = 1;
_fsCopy.search();
}
the search finds one more record than what is expected, i.e. if you had three rows checked and deselected two of them, what you’ve got are two records instead of just one, though the actual value of the ‘checked’ field within the records is ok, only the one left selected is actually set to 1.
The autosave property is not touched (so I suppose it should be set to true). Be that as it may, we’ve also tried saving data before proceeding with the find, to no use unfortunately.
Any ideas about what could be causing these?
P.S.: by the way, is there some way other than calling foundset.setSelectedIndexes() to use the builtin multiselect feature? We think something like ‘foundset.addSelectedIndex(index)’ could be useful in a case like ours.
EDIT: I forgot to say this happens in webclient only. Title updated