Announcement

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

    Picklist (SeleItem) stopped working in 14.0, if loaded from ds.xml

    Hi Support Team,

    We use to load our picklists using below code in older version

    <field name="filingType" title="Filing Type" type="text" required="false" editorType="select" allowEmptyValue="true" optionDataSource="PicklistValueDAODS" displayField="picklistDisplayValue" valueField="id" sortField="stringValue" >

    <optionCriteria><isActive>true</isActive>

    <picklistName>CaseFilingType</picklistName>

    </optionCriteria>

    </field>

    Now it is stopped loading picklist values in 14.0.

    Any suggestion to load the option picklist value through database from ds.xml?

    Thanks,
    Revan

    #2
    There is nothing obviously wrong in this short code snipped, other than that editorType should be the name of a class, e.g. SelectItem, not just "select". But that wouldn't breaking anything.

    Please see the "Debugging" topic in the JavaDoc to understand the information you need to provide to make it possible to help you.

    Comment


      #3
      It is rendering picklist as <span aria-hidden="true">&nbsp;</span>

      and getting Error

      Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.

      Comment


        #4
        You should fix the editorType="select" problem (previously mentioned) as that's invalid (and always has been).

        If that's not the problem, you likely have some code that you haven't shown which is setting that field to disabled or read-only.

        Comment


          #5
          I found the problem. It is because of <isActive>true</isActive>

          if returns always false - Attempt to compare a Boolean as String, testing value true with operator iEquals. This is an invalid comparison, so we are returning FALSE.

          Any suggestion to fix it in <field> tag ?

          Comment


            #6
            Below Code worked. Not sure if that right solution

            <optionCriteria>

            <AdvancedCriteria operator="and" _constructor="AdvancedCriteria">

            <criteria>

            <Criterion fieldName="isActive" operator="equals">

            <value xsi:type="xsd:boolean">true</value>

            </Criterion>

            <Criterion fieldName="picklistName" operator="equals">

            <value xsi:type="xsd:text">LitigationMatterType</value>

            </Criterion>

            </criteria>

            </AdvancedCriteria>

            </optionCriteria>

            Comment


              #7
              Sorry, we should have pointed out before - it is not actually valid to set optionCriteria on DataSourceField.

              You can see in the documentation that this is not a documented property for DataSourceField. In general, component-specific properties are not allowed on DataSourceField.

              So what you have right now is an unsupported hack, and if you want to stay within support, you should be setting optionCriteria on the SelectItem itself, and not attempting to set it in your DataSource.

              Note that for some reason you reported this as related to 14.0, but this has always been the case - the behavior is unchanged here in 14.0. Presumably, this is just a pre-existing bug in your app that you happened to notice during the upgrade process.


              Comment


                #8
                It is not pre existing bug. we have hundreds of picklists in application and are populating using same way across all pages. (We are using that code since from many years)

                I am not sure how best and easy to change our code as we have hundereds of DataSource files with above mentioned code.

                Our picklist model works based on database. All SelectItem options loads from picklist and picklist_value table

                e.g

                select pv.id, pv.string_value from picklist_value pv join picklist p on p.id=pv.picklist_id where p.name='<PicklistName>'

                Please suggest me a better approach to load the picklist values from datasource file.

                Comment


                  #9
                  There is no change in behavior here in 14.0 - placing optionCriteria directly into a .ds.xml file has never been supported, and in all versions of SmartGWT that have ever existed, you would have this exact problem with a value that was intended to be a boolean ending up as a String.

                  So it's still a mystery why you would be saying that you had this problem only after upgrading.

                  Further, there is no problem with using pickLists with an optionDataSource. That feature continues to be supported as it always has been. Your only problem is the attempt to set optionCriteria in .ds.xml. For however many cases of this undocumented usage you have, here are some options:

                  1) if the optionCriteria is intended as a security constraint, that is, end users should have this criteria enforced because they are not allowed to see some of the data, the right approach is operationBinding.criteria, which actually introduces server-side enforcement of the criteria. This would then constitute a correction of the application code.

                  2) if there is any kind of recurring pattern in the criteria that need to be applied, you could add logic either server-side (custom DataSource subclass) or client-side (custom SelectItem subclass) to automatically apply such criteria

                  3) outside of the above two cases, you can simply move the .ds.xml declarations to Java code that configures your SelectItem, using the setOptionCriteria() method

                  Comment

                  Working...
                  X