Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How define class for create fields of ListGrid

    Hello.

    We are trying create a class to put into the array of fields of a ListGrid, so the code results in this way:

    fields:
    [ isc.MyClassField.create(),
    { rest of fields...}]

    We suppose, that the superclass of "MyClassField" should be ListGridField, in this way:
    isc.ClassFactory.defineClass("MyClassField", isc.ListGridField)

    however, after several try outs, we can not get any success result.

    The question is: it should inherit from another class instead ListGridField?
    When you define in the reference ListGrid as "class" and ListGridField as "object". That grammar difference mean that first one is instantiable and the second one is not?
    which class should it inherit then?

    Thanks in advance.
    Cheers.

    We are working under:
    v9.0p_2013-08-20/PowerEdition Development SC and IExplrorer 10.0.9200 navigator

    #2
    Field definitions are not part of the SmartClient class system, they are plain Javascript objects - that is what the "object" designation in the docs means.

    What are you trying to achieve with this attempt to subclass ListGridField?

    Comment


      #3
      We want to create a class to define common attributes field, and so, fields which are going to be repeated, write once, and insert instance code at ListGrid.

      Comment


        #4
        Take a look at SimpleType as a means of sharing the definition of fields that have common validation, formatting and other similar behaviors.

        Aside from this, it's very unlikely that you have repeating fields with enough similarly that it's worth expending effort to share the definition. But if this somehow arises, just create a JavaScript function that returns a JavaScript Object (the field); do not attempt to subclass ListGridField, which is not a class, just an Object.

        Comment

        Working...
        X