Announcement

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

    Changing DataSourceField title on the fly

    Hi! I'm reading my datasource using DataSource.getDataSource. The xxx.ds.xml file has all the fields setup properly (with titles assigned).

    However, I need to replace one of the titles of the DataSourceFields in the datasource after a transaction.

    I tried doing this by calling datasource.setFields again (with the title change on the appropriate DataSourceField) but it complained that I couldn't do it.

    How can I do this change with my setup?

    #2
    Hi williamy,

    if I understood correctly it's easy:
    title=""-tag in ds.xml files is for display purposes only. You could just use setTitle(String title) for your ListGridFields (in a ListGrid) or FormItems (in a DynamicForm) after your transaction finishes.

    Best regards,
    Blama

    Comment


      #3
      I'm able to populate the datasource using setTestData, then passing the datasource into a listgrid with setDataSource. By calling fetchData on the listgrid, I'm able to see my data. I'm not populating the setFields on the listgrid at all. But you're saying that I have to use setFields to override the title?

      Comment


        #4
        Perhaps the following works on a loaded ListGrid:
        public ListGridField ListGrid.getField(java.lang.String fieldName), eg. lg.getField("yourField").setTitle("newTitle");.

        Best regards,
        Blama

        Comment


          #5
          Unfortunately, what you suggested did not work. I suspect because there are no fields set with the grid (the fields are set in the datasource).

          Comment

          Working...
          X