Announcement

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

  • DynamicForm / ListGrid with dynamic fields from json content do not work

    Hi,
    I have a simple smartclient-REST-server/DB application, in one of the database tables I need to add some custom columns (deployment-specific). I thought to introduce a single column with json content and configure project-specific columns put in this (I know the limitations, there is no need to do any SQL filtering on the content - even if, it would be possible, but this is off topic now). This way I was hoping to be able to map the json fields into separate FormItems on the GUI and display and edit them. I can also configure these fields on the GUI in deployment-specific way.

    I thought I could solve it with any of the FormItem.setDataPath or DataSourceField.setValueXPath or DataSourceField.setFieldValueExtractor, but even when I'm following the example under e.g. http://www.java2s.com/Code/Java/GWT/...nsSmartGWT.htm the fields are not displayed.
    With the FieldValueExtractor solution I even debugged into the data extraction procedure inside smartclient and the data was extracted correctly (the returned fields contained the expected extracted subfields), still the data was not bound with the same-name FormItem. I also added the column to a ListGrid and it also did not show the value either.
    So data is coming in a field 'customfields' as e.g. customfields: "{"fromday":"2019-01-12","today":"2019-02-01"}", and is internally extracted into separate result fields "customfields_fromday" and "customfields_today"
    And I added a TextItem / ListGridField with name "customfields_fromday" and expect it - at first in GET direction - to show the extracted value.
    With the FieldValueExtractor solution I even returned a plain text "Example" and followed it up in the call sequence, but the form did not display anything.

    Can anyone help me with this? Refactoring the complete application into something else is not an option.
    Thank you
    Zoltan

    Using 64 bit Chrome 71.0.3578.80
    Version v11.0p_2018-05-16 (2018-05-16)

  • #2
    We have both samples and automated tests showing that these features work in general, and we canít debug your prose. We need to see your data, DataSource and form/grid definitions in order to point out the error.

    But one very basic thing to do is just look at the resulting record coming from the DataSource, and if it has the expected data, make sure the field names in your form are the same. Remember they are case sensitive.

    Comment


    • #3
      Hi,
      Sorry, my fault.
      Everything I tried to do did not work (and yes, everything matched), examples seem to be of no use or I completely misunderstand usage of xpath / datapath.
      Tried even https://www.smartclient.com/smartgwt.../DataPath.html with no meaningful result.

      However, I realized that I had some custom code to read and write fields, so I simplified the case into transparent provision of json content and manually extracting / composing the json content in client code.
      Even though the original problem is unsolved, I consider this case as solved.

      Comment

      Working...
      X