Announcement

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

    includeFrom and setFilterEditorProperties

    Hi,

    I'm using SmartClient Version: v8.3p_2014-03-06/PowerEdition Deployment (built 2014-03-06) (SmartGWT 3.1p) with PostgreSQL 9.2.2, Firefox 26 and Tomcat 7.0.33.

    I have some look up tables in the database. I want to use includeFrom to reference the values in these tables.

    I have been using 'Smart GWT EE Showcase - Java Data Integration - SQL - Field Include' from your web site as an example of how to do this.

    Referencing the look up table with includeFrom worked fine for the value in the listGrid. Your example shows a pull down list in the FilterEditor for the Country column and this pull down list is populated with entries from the datasource countryIncludeFromSQL.ds.xml. My result was different. I was getting the list of values from the original data source. Not the includeFrom dataSource.

    Eventually I copied the code from your example into my application and the behavior of your example changed. It started showing the list of countries from the cityIncludeFromSQL.ds.xml dataSource instead of countryIncludeFromSQL.ds.xml. This behavior was consistent with how my code was behaving. I then figured out that I needed to use setFilterEditorProperties on the list grid field to provide an optionDataSource and a displayField for the FilterEditor.

    I don't understand why the Showcase gets the correct pull down in the FilterEditor when the source it shows doesn't include the setFilterEditorProperties call. Is the SmartGWT version used for the showcase on your website smarter than the version I'm using? Is the optionDataSource being set somewhere else that I missed? Is the code that is running the example different than the source shown with the 'View Source' button?

    I'm confused. Please help.

    Thanks,
    Kevin

    #2
    See DataSourceField.includeFrom docs - the settings for includeFrom, foreignKey and displayField imply the optionDataSource that should be used by default.

    Comment


      #3
      Hi,

      Thank you for the reference. I've reviewed the DataSourceField.includeFrom docs. Setting up the foreign key, the display field and a separate include from field to support the display field should provide enough information to automatically chose a SelectItem editor with an optionDataSource.

      I didn't see a discussion of the FilterEditor in the DataSourceField.includeFrom docs. The same information which implies an editor could also imply a FilterEditor, but I didn't see this called out in the docs. It looks like an automatic FilterEditor is being created when I run the Showcase from the Isomorphic website. The foreign key, display field and separate include from field are set up and I get the list of four countries when I pull down the pick list for Country in the FilterEditor.

      However, when I take the FieldInclude example code and add it to my application (I only change how it is called and use the postgres database), it doesn't work correctly. When I pull down the pick list for Country I get 6 values which correspond to the country values in the city table. In the developer console I see it doing a fetch on the city table instead of country to populate the SelectItem. This is what it would do without setting the filter editor. Why does my environment work differently than yours?

      I deployed the showcase.war file which came with my 3.1p Power 2014/3/6 nightly build. The selection list for country in the FilterEditor shows the six country entries like it is reading the city table. The Source for that example shows the country field's editor type being specifically set. This explicit call to setEditorType is not in the source for the version on your web-site. The showcase.war file version doesn't do anything with setFilterEditorProperties. The editor field shows the 4 countries like it should. The Filter Editor shows six country entries like it is using a default filter editor off the city table. It is not using an automatically generated FilterEditor based on the foreign key, display field and include from data.

      It looks like my version of SmartGWT doesn't create good automatic filter editors for fields with foreign key, display field and separate includeFrom field. Is this what you expect or is this broken?

      Thanks,
      Kevin

      Comment


        #4
        There is indeed more automatic defaulting in the new version, and the Showcase example was simplified in the new version to take advantage of this.

        You definitely should not be using such an old version for new development - not being able to take code from the public Showcase (since it's for a new version) is just one problem; another is that support for new browsers released well after 3.1 is not being backported.

        Comment


          #5
          Thank you very much for the update. That all seems very reasonable.

          I'm adding some features to an existing 3.1p application so I was maintaining the 3.1p environment. I could upgrade. I've just downloaded the current version of Power 4.1p. I don't have a sense for how much work it would be to upgrade.

          I expect that some of my 3.1p based implementation will need to change when I upgrade. Is there any document or guidance on what to look for (what breaks) when upgrading to 4.1p? I can always just swap 4.1 into the application. Changes that throw development errors will be easy to find although I may not know how to fix them. Places where the behavior is just different, would probably require a testing cycle or a heads up to find. Is there a list of things to look for?

          Thanks,
          Kevin

          Comment


            #6
            4.1 is backwards compatible to 3.1 so there's nothing to look for. Lots of developers have already done this migration and caught a few regressions, which are already patched in the latest 4.1 builds.

            If you find some problem on upgrade, it could be a reliance on undocumented functionality, or a legit regression that somehow no one has found yet - either way just start a thread for it and provide all the usual information.

            Comment


              #7
              Hi,

              Thank you for the information. I upgraded to 4.1p and it was very smooth. I just had to update some deprecated references (com.smartgwtpower stuff) which were clearly called out in the IDE and clear caches (browser and unitCache). It all went well.

              Thanks,
              Kevin

              Comment

              Working...
              X