Setting a Data Grid to readonly

Questions and answers for designing and implementing forms in Servoy

Setting a Data Grid to readonly

Postby huber » Fri Feb 03, 2023 6:20 pm

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,
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Setting a Data Grid to readonly

Postby Gabi Boros » Wed Feb 08, 2023 2:33 pm

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.
Gabi Boros
Servoy
Gabi Boros
 
Posts: 406
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: Setting a Data Grid to readonly

Postby huber » Thu Feb 09, 2023 11:14 am

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,
Attachments
pruefungsfaecher.png
pruefungsfaecher.png (27.97 KiB) Viewed 2049 times
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Setting a Data Grid to readonly

Postby Gabi Boros » Thu Feb 09, 2023 11:30 am

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?
Gabi Boros
Servoy
Gabi Boros
 
Posts: 406
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: Setting a Data Grid to readonly

Postby huber » Thu Feb 09, 2023 12:48 pm

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.
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm

Re: Setting a Data Grid to readonly

Postby Gabi Boros » Thu Feb 09, 2023 3:06 pm

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.
Gabi Boros
Servoy
Gabi Boros
 
Posts: 406
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: Setting a Data Grid to readonly

Postby huber » Thu Feb 09, 2023 3:31 pm

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.
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 518
Joined: Mon May 14, 2012 11:31 pm


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests

cron