[ListRecords_Utils] Bulk select for list records not working when AJAX refreshing the list records
Forge component by Marcelo Ferreira
Application Type
Traditional Web
Service Studio Version
11.10.13 (Build 39571)

Hi there,

I have discovered that the Bulk Select widget for list records is not working when you need to perform an AJAX refresh on the list records. I`ve used both Microsoft Edge and Firefox. I am attaching a minimalistic application consisting of two almost identical screens to demonstrate this.

The application is currently running in my personal environment found here:

https://dimitriosbessas.outsystemscloud.com/BulkSelectIssue


In one screen the bulk select is working fine, in the other it i``s not. In the screen that is not working, there is a screen action (which by the way is not used anywhere) that contains an AJAX refresh of the list records. This AJAX refresh widget breaks the bulk select. You can try to disable or delete it, republish to confirm that the issue is caused by this.

When I compared the source codes, I found out that in the screen that the bulk select is not working, Outsystems wraps all list records with a <span> tag. When I checked the JavaScript code of the Bulk select component, I saw that it is trying to find <div> elements that are children of the list records. But now those <div> elements are one level lower in the DOM hierarchy and the children method fails to locate them. 

I managed to clone the bulk select component and edit the JavaScript so that it locates <span> tags instead. 

i.e I changed this:

 $('#' + TableRecordsWidget).children("div").find('input:checkbox').each(function() {

to this:

$('#' + TableRecordsWidget).children("span").find('input:checkbox').each(function() {

This fixed the issue but of course it would not work for other screens where AJAX refresh is not used. I`m not an expert really in JavaScript so I cannot suggest what would be a correct fix that covers all use-cases.


Best regards

Dimitrios Bessas

  

BulkSelectIssue.oap

Hi Dimitrios


Replace the javascript in the ListRecords_BulkSelect block for the attached one.
I just removed all div references. Now javascript is trying to find checkboxes inside the ListRecords widget, not caring if they are inside a div or inside a span. 


Cheers 

ListRecordsBulkSelect.txt

 I just saw that this post is from 2019...

Hi Victor, no my post was only 10 days old. The widget was uploaded in 2019.

Thanks a lot for the updated JavaScript!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.