Forums

Find answers, ask questions, and connect with our
community all around the world.

Home Forum Omnis General Forum Reference an object in a superclass

  • Reference an object in a superclass

    Posted by Obonye on October 5, 2023 at 7:48 am

    Hi, 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
  • Andreas Pfeiffer

    Administrator
    October 5, 2023 at 7:52 am

    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

    • Obonye

      Member
      October 5, 2023 at 8:59 am

      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.

      • Andreas Pfeiffer

        Administrator
        October 6, 2023 at 12:04 pm

        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

        • Obonye

          Member
          October 6, 2023 at 1:14 pm

          Aha! I see where I am drifting off. The property insight is a pointer in the right direction. Thank you.

          • Obonye

            Member
            October 6, 2023 at 1:28 pm

            But why I am unable to get the property of an object’s $designcols? I am able to get other properties such as name.

            • Andreas Pfeiffer

              Administrator
              October 6, 2023 at 1:32 pm

              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

  • Obonye

    Member
    October 6, 2023 at 5:03 pm

    You are always dependable and very helpful. Thank you, Andreas.

    • Andreas Pfeiffer

      Administrator
      October 8, 2023 at 6:42 pm

      Thank you Martin,

      Have fun.

      Best,

      Andreas

Log in to reply.