TiNG 2024.09.0.4001 Grid Behavior Changed

In Servoy 2024.09.0.4000, a left-click on a grid row would open an edit window.

In Servoy 2024.09.0.4001, this behavior has changed. A left-click on a grid row no longer opens the edit window. A right-click on the grid row is needed to select the row, then a left-click to open the edit window.

Has anyone experienced this? What changed, and how do we fix this?

There are no errors in the servoy_log.txt file.

Correction, the grid problem appears when using…

Servoy 2024.09.0.4000
Servoy 2024.09.0.4001
Servoy 2024.09.0.4002

Using Servoy 2024.6.1.3983, the grid works as expected (using the same .servoy file for all tests).

The Servoy 2024.09.0.400x installs all required the following update which may be the problem…

[attachment=0]servoy_ng_grids_2024_6_0.png[/attachment]

No one has this issue? Just me?

To give further context for this issue,

how the algorithm is setup for us, the ‘onClick’ action for the grid loads a new edit form.

This means, for whatever reason the new version of Servoy changed the behavior of the onClick & it isn’t triggering with a left click anymore. And apparently needs a right click first to select it, then the left click runs the onClick.

Did Servoy change the behavior of ‘on Select’ and ‘on Click’ for the grid or something? To mean that you can only click selected records? That’s my only guess to the behavior change.

Hi John,

I can’t see this problem in 2024.09
Most likely our way’s to determine the clicked column in the function assigned to the ‘onCellClick’ event are different.
Can you share the code you are using?

‘onCellClick’ is triggered just fine for me; do you see the same issue also in a simple grid sample? can also check the logs for any exceptions?

Here’s the code setup.

/**
 * @param {number} foundsetindex
 * @param {number} [columnindex]
 * @param {JSRecord} [record]
 * @param {JSEvent} [event]
 * 
 * @protected 
 * 
 * @override
 *
 * @properties={typeid:24,uuid:"641035BF-377A-40D3-96B7-50D20C295AC1"}
 */
function onCellClick(foundsetindex, columnindex, record, event) {
	
	foundset.selectRecord(  record.getPKs()[0] )
	
	if( columnindex > 3 )
	{
		
		// [ edit screen record ]
		
		forms.page_edit.foundset.loadRecords( record.getPKs()[0] )

		scopes.NAV.change_forwardForm( 'form_edit', scopes.NAV.define_FormTypes.Edit )
	}
	
	
	return 
}

I am using the column index to prevent pinned columns to be clicked on essentially. Perhaps the column index aspect though changed in the Servoy update.

Hi John,

although the first line: foundset.selectRecord( record.getPKs()[0] )
seems unnecessary to me, it shouldn’t do any harm.

Personally I use the column id to reference any columns, you need to enter a name in the id property of columns to do that.
This way your code will still work even when adding/deleting/reordering columns.

var col = elements.myGrid.getColumnById(columnindex)
var colID = col.id

Last enhencement I’d do is get rid of the cross-form use of the Servoy API and replace them by calling a dedicated function on the other form.
So forms.page_edit.foundset.loadRecords(… should be forms.page_edit.loadRecords(record.getPKs()[0])
Then create a function on the page_edit form like this:

function loadRecords(pk) {
     foundset.loadRecords(pk)
}

Anyway, like Gabi also mentioned: the onCellClick does get triggered for us, and reading your original post, I think it does for you as well.
Can you comment (or temporarily delete) that first line and see what happens?

Grid setting selectionMode SINGLE/MULTIPLE is the culprit in Servoy 2024.09.0.400x.

Our grid selectionMode is set to SINGLE, and this disables the associated onClick() method. When we change the selectionMode to MUlTIPLE, then the onClick() method fires.

So, the grid behavior has changed in 2024.09.0.400x. Is this change intentional, or was a bug introduced?

NG Grid has no ‘selectionMode’ property, did you set that via gridOptions? NG Grid sets the selectionMode of aggrid based on the selectionMode of its foundset, so, you should avoid setting that via gridOptions; but I also tested this,
by forcing the setting via gridOptions but still, onClick is fired

My mistake! You are correct, Gabi…it’s not a grid setting. selectMode is a form setting.

[attachment=0]form_grid_selectMode.png[/attachment]

To confirm, you are saying to not use selectMode at all, and let the foundset dictate the setting for the grid?

Thanks!

ng grid always checks the selection mode of the foundset, and then sets the right selection setting in aggrid (the 3rd patry component used by ng grid);
so, what I mean, you should never set the selection mode of ng grid, via its gridOptions property, that is a shortcut for direct setting on aggrid,
but you should just set the selection mode on the foundset - by code, or using that form property (that also just sets the selection on the form’s foundset)

So is the Selection Mode option that’s available on the form itself just a deprecated feature then? Since changing it to ‘Single’ selection alters the behavior entirely of how the foundset selection is working. Or was this an intentional redesign on Servoy’s part?

john1598360627:
So is the Selection Mode option that’s available on the form itself just a deprecated feature then? Since changing it to ‘Single’ selection alters the behavior entirely of how the foundset selection is working. Or was this an intentional redesign on Servoy’s part?

NO, the selectionMode property of the form is not deprecated; setting rowSelection in ng grid’s gridOptions property is not recommended

Gabi Boros:

john1598360627:
So is the Selection Mode option that’s available on the form itself just a deprecated feature then? Since changing it to ‘Single’ selection alters the behavior entirely of how the foundset selection is working. Or was this an intentional redesign on Servoy’s part?

NO, the selectionMode property of the form is not deprecated; setting rowSelection in ng grid’s gridOptions property is not recommended

So, to reiterate here;

Avoid the gridOption rowSelection setting.

Avoid selectionMode property of the form because it isn’t functioning properly… correct?

Or is there a new alternative selection mode available? Or just avoid all the selection mode stuff entirely.

john1598360627:
Avoid the gridOption rowSelection setting.

yes!

john1598360627:
Avoid selectionMode property of the form because it isn’t functioning properly… correct?

no!, I never said that; selectionMode of the form is not deprecated and it works as it should.

john1598360627:
Or is there a new alternative selection mode available? Or just avoid all the selection mode stuff entirely.

no! setting selection mode is available and widely used; you can set it directly on the foundset of via the form using its selectionMode property

john1598360627:
Or is there a new alternative selection mode available? Or just avoid all the selection mode stuff entirely.

We use our grids in single selection mode, unless you start selecting multiple records via a dragndrop-column, since that’s the only place we make use of multple selected records.
This code lives in onCellClick of the grid:

	/** @type {RuntimeWebComponent<aggrid-groupingtable>} */
	var groupingGrid = event.getSource();
	var column = groupingGrid.getColumn(columnindex);
	if (column.dndSource) {
		groupingGrid.myFoundset.foundset.multiSelect = true;
	} else {
		groupingGrid.myFoundset.foundset.multiSelect = false;
	}

That way we can switch between the modes only on certain grids when we need it.
If you want it the other way round you could build something in the onLoad() of the form, see if you have a grid and set the mode accordingly.