Announcement

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

  • customSelectExpression not applied in SimpleType

    Hi Isomorphic,

    please see this testcase:

    /builtinds/war/ds/mytype.type.xml

    Code:
    <SimpleType name="mytype" inheritsFrom="text" customSelectExpression="'in SimpleType'">
     <field customSelectExpression="'in field Tag'" />
     <customSelectExpression>'as cSE Tag'</customSelectExpression>
    </SimpleType>

    /builtinds/war/BuiltInDS.html

    Code:
    <!DOCTYPE html>
    
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <!--                                           -->
        <!-- Any title is fine                         -->
        <!--                                           -->
        <title>BuiltInDS</title>
    
        <!-- IMPORTANT : You must set the variable isomorphicDir to [MODULE_NAME]/sc/ so that the SmartGWT resource are 
          correctly resolved -->    
        <script> var isomorphicDir = "builtinds/sc/"; </script>
    
        <!--                                           -->
        <!-- This script loads your compiled module.   -->
        <!-- If you add any GWT meta tags, they must   -->
        <!-- be added before this line.                -->
        <!--                                           -->      
        <script type="text/javascript" language="javascript" src="builtinds/builtinds.nocache.js"></script>
    
        <!-- The following script is required if you're running (Super)DevMode and are using module
             definitions that contain <script> tags.  Normally, this script is loaded automatically
             by builtinds.nocache.js above, but this isn't possible when (Super)DevMode is running.
             Note: it should not create any issue to always load it below (even if already loaded). -->
        <script type="text/javascript" language="javascript" src="builtinds/loadScriptTagFiles.js"></script>
    
      </head>
    
      <!--                                           -->
      <!-- The body can have arbitrary html, or      -->
      <!-- you can leave the body empty if you want  -->
      <!-- to create a completely dynamic UI.        -->
      <!--                                           -->
      <body>
    
        <!--load the datasources-->
        <script src="builtinds/sc/DataSourceLoader?dataSource=supplyItem,animals,employees,mytype"></script>
    
        <!-- OPTIONAL: include this if you want history support -->
        <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
    
      </body>
    </html>

    Code:
    <DataSource
        ID="animals"
        serverType="sql"
        tableName="animals"
        testFileName="animals.data.xml"
    >
        <fields>
            <field name="commonName"      title="Animal"             type="mytype" />
            <field name="scientificName"  title="Scientific Name"    type="text"  primaryKey="true"  required="true"/>
            <field name="lifeSpan"        title="Life Span"          type="integer"/>
            <field name="status"          title="Endangered Status"  type="text">
                <valueMap>
                    <value>Threatened</value>
                    <value>Endangered</value>
                    <value>Not Endangered</value>
                    <value>Not currently listed</value>
                    <value>May become threatened</value>
                    <value>Protected</value>
                </valueMap>
            </field>
            <field name="diet"            title="Diet"               type="text"/>
            <field name="information"     title="Interesting Facts"  type="text"  length="1000"/>
            <field name="picture"         title="Picture"            type="image" detail="true"
                   imageURLPrefix="/isomorphic/system/reference/inlineExamples/tiles/images/"/>
        </fields>
    </DataSource>

    (I used the normal (not modified) class BuiltInDS.java)

    Expected Behaviour:
    One of the customSelectExpression(s) in SimpleType "mytype" gets applied -> "as cSE Tag" or "in SimpleType" gets shown in column "commonName"


    Real behaviour:
    Neither of the customSelectExpression(s) gets applied, values are shown as in the database.

    (I also testes two cases with only one cSE)

    Its importent for us, that the customSelectExpression in SimpleType "mytype" gets applied. Please take a look at it, and let me know if there is something wrong with this usage or if this is a bug.

    setup:
    SmartClient Version: v12.0p_2019-04-11/PowerEdition Deployment (built 2019-04-11)

    Thanks in advance,
    Kind Regards


  • #2
    There is no simpleType.customSelectExpression in the docs, so this isn't a bug. It sounds like this is a feature you would liked added, so please consider Feature Sponsorship.

    Note also that if you wanted a particular customSelectExpression to be applied wherever a certain simpleType is used, you could achieve that yourself with a DynamicDSGenerator (see QuickStart Guide).

    Comment


    • #3
      Ok, thanks for the quick answer. Could You state out, what actually is supported in simpleType then? That would be very helpful.

      Thanks in Advance,
      Kink Regards

      Comment


      • #4
        Sorry, we don't understand the question.

        What is documented is what is supported, as with all other classes.

        Could you clarify what you're asking?

        Comment


        • #5
          Hi Isomorphic,

          what I meant was what information I could possibly declare for the field in SimpleType?
          e.g.:
          displayField="some_name" title="some_title" required="true" sqlStorageStrategy="singleChar10" escapeHTML="true" etc. Regarding to this https://forums.smartclient.com/forum/smart-gwt-technical-q-a/28970-simpletype-to-outsource-more-than-validation-display?p=184344#post184344 You said it could be done with simpleType.fieldProperties. [FONT=arial, helvetica, sans-serif]My question is how would I write it in a .type.xml file? Like this: [/FONT]
          Code:
           <SimpleType xmlns="some_link" xmlns:fmt="some/fmt" name="booleanType" inheritsFrom="boolean" >     <fmt:bundle basename="some_base" encoding="utf-8" />     <FieldProperties sqlStorageStrategy="singleChar10" escapeHTML="true"></FieldProperties> </SimpleType>
          or like this:
          Code:
           <SimpleType xmlns="some_link" xmlns:fmt="some/fmt" name="booleanType" inheritsFrom="boolean" sqlStorageStrategy="singleChar10" escapeHTML="true">     <fmt:bundle basename="some_base" encoding="utf-8" /> </SimpleType>
          I read the docs, but I can't find anything about it, only how it works with validators. I also tried to find something in the forum but without success. So it would be very nice if You could clarify 1. what field information are supported e.g. sqlStorageStrategy, escapeHTML like asked above 2. how can I use them? Do I need to specify them in the <SimpleType...> tag or in a <FieldProperties...> tag? A little example in xml-format would be highly appreciated. Thanks in advance and Kind Regards

          Comment


          • #6
            Still not understanding this question. It's as if you think SimpleType isn't documented, but it is:

            https://www.smartclient.com/smartgwt...impleType.html
            https://www.smartclient.com/smartgwt...impleType.html

            Maybe the problem is that you have not seen that there is a general overview of how to use XML for such declarations here?

            https://www.smartclient.com/smartgwt...e-summary.html

            Note also that fieldProperties is not part of what can be set on the server, so you cannot set server-side properties that way.

            Comment


            • #7
              Hi Isomorphic,

              of course we checked these docs.
              The problem is that the tag <FieldProperties>, which you claim as working here in the way I tested in that thread, is not working for us and is not documented in the SimpleType-ds.xml docs (or I did not find it).
              So we tried different methods, some of those Developer12145 shows in this thread, but never got it working.

              Goal is - as my thread from 2013 describes to offload repeating field configurations in a type that then is referenced.
              In my case these were displayFields for fields of type createdBy and modifiedBy and in the case here it's the storage-definition of boolean-fields.

              This is a) very repetitive and tedious to change if needed and b) is responsible for a considerable portion of the document size of the DataSourceLoader result.

              Best regards
              Blama

              Comment


              • #8
                If you mean that fieldProperties is not affecting server behavior, that's what the docs indicate. It's doc'd as a client-side property but not a server-side property.

                An enhancement to the SimpleType system to make this possible makes sense, but it's not a trivial change (and isn't a bug) - this would be something to look at as a Feature Sponsorship.

                Comment


                • #9
                  Hi Isomorphic,

                  the problem for all this time we invested now is that here you make it sound like it is working serverside in .ds.xml for the very task we are asking about. Please see that you are referring to DataSourceLoader in your response there.
                  This all is a bit unfortunate. Also this would be a great feature for everyone, even without Feature Sponsorship.

                  Best regards
                  Blama

                  Comment


                  • #10
                    It looks like in that other thread there is indeed one mention of trying to use includeFrom from a SimpleType. All the other properties mentioned are client-side properties that do work via fieldProperties.

                    While includeFrom has client-side effects, it's true that it is principally a server-side property and we see how you might have concluded that server-side properties were valid in fieldProperties, despite the docs suggesting otherwise. Sorry for any confusion there. We are already in the midst of updating the docs so that such confusion cannot arise.

                    As far as any possible future support for additional server-side properties in the SimpleType declaration, we won't be doing that by making properties specified in fieldProperties suddenly begin having server-side effects. Rather we'll add support for individual properties that make sense and doc such properties on SimpleType.

                    So far as we understand there is just a single organization requesting such support in this thread, but let us know if that's not the case - user votes count in our prioritization process, of course.

                    We'd also like to understand which specific properties are most desirable.

                    Comment


                    • #11
                      Hi Isomorphic,

                      understood.

                      W.r.t. current state of fieldProperties as attribute of SimpleType: If it is useable to configure some client side settings from .ds.xml, these are not clear, as it is not doc'd in SimpleType. Or are all the properties here under SimpleType a synonym for fieldProperties, when you write about this?

                      W.r.t the features used here:
                      As of today, I'd like to use the feature for "DRY", so to have smaller .ds.xml, where it is also possible to change all instances of a user-defined type in a single place.
                      So far, the use cases here involve:
                      • boolean fields, used attributes:
                        • sqlStorageStrategy
                        • escapeHTML
                      • repeated configurations of creator/modifier/createdAt/modifiedAt fields. used attributes:
                        • canEdit
                        • canSave
                        • primaryKey
                        • includeFrom
                        • foreignKey
                        • customSelectExpression
                        • escapeHtml
                        • displayField
                        • sortByField
                        • hidden
                        • length
                        • title fmt-subtag
                      W.r.t involved organizations:
                      This thread and the linked one are from my colleague and me. Any other user please feel free to +1 this.

                      Best regards
                      Blama

                      Comment


                      • #12
                        So again, you can use fieldProperties in a .type.xml file but only properties with client-side effects will work. We will be updating the docs to make this clearer.

                        Comment


                        • #13
                          OK, I'll wait for the docs update then.

                          Comment

                          Working...
                          X