Home › Forum › Omnis General Forum › Reference an object in a superclass
Tagged: Android, Database, General Coding
-
Reference an object in a superclass
Posted by Obonye on October 5, 2023 at 7:48 amHi, I have created a dataGrid object in the superclass of a jsMainForm. How do I get the reference to this dataGrid object? I have a method $getRef in the dataGrid with “Quit method $cinst.objs.dataGrid”. If I call this method in a $cfield, the return value references to the mainForm instead of referencing the superform.
Any help is appreciated.
Andreas Pfeiffer replied 11 months, 2 weeks ago 2 Members · 8 Replies -
8 Replies
-
Hi Martin,
There is no difference in the instance if the code is in the inherited form or in its superclass. The instance is the same.
Maybe I understand this wrongly. What exactly do you get back when you debug the code and look at the item reference variable?
Best,
Andreas
-
Please see the attached screenshot of the returned reference. The jsChildDataListCustomReport inherits from a parentForm. If I run “Calculate <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>designcol as <b style=”font-family: inherit; font-size: inherit; color: var(–bb-body-text-color);”>pQueryDataGridRef.$designcols” I get 1 which is wrong.
-
Hi Martin,
I do not see anything wrong in the reference. It points to the grid component in the instance.
However $designcols is a property that is not accessible in the instance. That is why it is called $designcols.
Best,
Andreas
- This reply was modified 11 months, 2 weeks ago by Andreas Pfeiffer.
- This reply was modified 11 months, 2 weeks ago by Andreas Pfeiffer.
-
Aha! I see where I am drifting off. The property insight is a pointer in the right direction. Thank you.
-
But why I am unable to get the property of an object’s $designcols? I am able to get other properties such as name.
-
Reading properties might only be possible in client methods. You may be able to read $name or $id from a server side method but some code might have changed a color on the client, so how would the server read such a property.
Therefore this can only be done from a client executed method.
Best,
Andreas
-
-
-
-
-
You are always dependable and very helpful. Thank you, Andreas.
Log in to reply.