Page 1 of 1

Setting a Data Grid to readonly

PostPosted: Fri Feb 03, 2023 6:20 pm
by huber
I thought, a code line like

Code: Select all
   elements.gridExamDefinitions.readOnly = true;


would correspond to the Data Grid property readOnly set (by checkbox which equals to true), but that's not the case, at least in Servoy Developer 202206. What is the intention of this Data Grid property readOnly?

By the way, when setting a Data Grid to readOnly, the onCellClick event is still executed. Does not sound logical to me, as readonly means to me a user can't do anything. Is there a reason for this behaviour?

Thanks for clarifying and best regards,

Re: Setting a Data Grid to readonly

PostPosted: Wed Feb 08, 2023 2:33 pm
by Gabi Boros
hi Robert,

readOnly is for data changing, so when you set that, you won't be able to change data in the grid, the cells won't be editable, they won't enter in editing-mode.
To stop mouse click events on the grid, you should use the enabled (= false) property.

Re: Setting a Data Grid to readonly

PostPosted: Thu Feb 09, 2023 11:14 am
by huber
Hi Gabi

Thanks for your explanation and pointing to the property enabled (false).

Following screenshot is part of a menu in our application and used to explain the situation:

There is a difference between using the code line like following:

Code: Select all
elements.gridExamDefinitions.readOnly = true;

which sets both checkboxes to readOnly as expected, AND

setting on the gridExamDefinitions the readOnly property to true,

which still allows to set/unset the checkboxes. This is not the expected behaviour, as it is – as you say – a data change.

Best regards,

Re: Setting a Data Grid to readonly

PostPosted: Thu Feb 09, 2023 11:30 am
by Gabi Boros
so, the issue is, if I understand correctly, that setting the readOnly property at design time is ignored, but setting it at runtime, in the code, it works - can it be
that at runtime it is set to false in the code? because that will override the design time setting ... if not, it is possible to have a sample with this issue?

Re: Setting a Data Grid to readonly

PostPosted: Thu Feb 09, 2023 12:48 pm
by huber
Hi Gabi, you do understand it correctly, and it is not overwritten to false somewhere in the code.

I do not have a practical example at hand, but I just use one line of code, i. e.

Code: Select all
elements.gridExamDefinitions.readOnly = true;

in the onShow method versus NOT using this line of code and checking the grid property readOnly (true). The grid just has to have a column with editType CHECKBOX.

This should be easy to test in your environment (hopefully :-).

Thanks for your analysis.

Re: Setting a Data Grid to readonly

PostPosted: Thu Feb 09, 2023 3:06 pm
by Gabi Boros
Hm, I did a test with Servoy 2022.12 & latest NG Grids from SPM, and it works ... can you also try with these versions as I see you're using 2022.06, even though I don't recall such an issue on that version.

Re: Setting a Data Grid to readonly

PostPosted: Thu Feb 09, 2023 3:31 pm
by huber
Hi Gaby

Good to hear it works in this environment. I will try it here as well, but for the moment I can't switch to version 202212, because we still need Java 1.8 and Smart Client.

Thanks a lot for your testing.

Regards,

Gabi Boros wrote:Hm, I did a test with Servoy 2022.12 & latest NG Grids from SPM, and it works ... can you also try with these versions as I see you're using 2022.06, even though I don't recall such an issue on that version.