Multi-Select Odd Behavior

Discuss all problems you have with Servoy here. It might help to mention the Servoy version and Operating System version you are using

Multi-Select Odd Behavior

Postby john1598360627 » Sat Feb 18, 2023 4:36 am

SERVOY VERSION: 2022.12.1.3824

I'm getting odd behavior from the multi-select.

Code: Select all

I'm doing a process where I'm grabbing the array of records, and doing a forEach of each record and applying a function to each one.

Code: Select all
// For Every Selected Account
        * @param {JSRecord<db:/example_db/table_test>} record
        * @param {Number} index
        * @param {JSFoundset} fs
      function( record, index, fs )
         // validate
         archive_Records( record.col_id)

Code: Select all
* @private
* @properties={typeid:24,uuid:"AFAB7AFA-5659-4154-A735-88972A17BADC"}
function archive_Records( ID ) {
   /** @type {JSFoundset<db:/example_db/table_test>} */
   var fs = databaseManager.getFoundSet( 'example_db', 'table_test' )
   /** @type QBSelect<db:/example_db/table_test> */
   var query = datasources.db.example_db.table_test.createSelect()
      query.columns.col_id.eq( ID )
   fs.loadRecords( query )
   var fs_updater = databaseManager.getFoundSetUpdater( fs )
   fs_updater.setColumn( 'col_flag_archive', 1 )

   databaseManager.saveData( fs )
   application.output( "Archived: " + ID )

My algorithm seems to run fine and applies correctly. However I'm having an issue with the Multi-Select behavior.

When first open a grid, I can for example select 4 records and then 'archive' them with my algorithm.

I have an 'unarchive' algorithm that is the exact same but changes 1 to 0. I try and apply the Unarchive algorithm, however it only gets apply to 1 record instead of 4... This is when I realized that for some reason, after running my first algorithm that the multi-select de-selects everything automatically and leaves only 1 selected. Even when trying to re-select stuff, only one record is passed by the foundset.getSelectedRecords().

However, when I swap to another form with a grid, then swap back, I'm able to run my Archive algorithm again. I have no idea why or what is going on with this behavior!

My guess is that updating the table related to the foundset of the grid freaks out the multi-select.

Any help is appreciated!
Posts: 138
Joined: Tue Aug 25, 2020 3:03 pm

Re: Multi-Select Odd Behavior

Postby john1598360627 » Tue Mar 14, 2023 2:36 am

I experimented with this more. This seems to be an issue with the Checkbox Selection I'm using on the NG Grid.

On a Data Grid, I have a column with the column definition of 'checkboxSelection' set to TRUE. This allows me to multi-select with a checkbox.

After I select multiple records, I execute my algorithm and it effects all the records.

However, this is where the issue comes in, it still shows multiple records selected. However, if I try to run my algorithm again it only applies to one.

And to prove what's going on, I would 'de-select' the records and then run the algorithm again, which then effected the specific unselected records.

Basically, the checkbox selection isn't updating to showcase what is actually selected by the foundset for some reason.

Is checkbox multi-select just not supported? Should I make a project to showcase this problem so this can be fixed?

If there was just a way of resetting the checkbox selection it would be in sync with the foundset select. It being de-synced is what's causing the problem.
Posts: 138
Joined: Tue Aug 25, 2020 3:03 pm

Return to Discuss possible Issues and Bugs

Who is online

Users browsing this forum: No registered users and 3 guests