Announcement

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

    Implementing default grouping - problem with date field type

    I'm using SmartGWT LGPL 4.0
    I would like to get grouping configuration, persist it in DB and set it back in list grid when user will open view again.

    I can see list grid methods: getGroupByFields() and setGroupByFields() that should be fine for most of the cases.
    But in case of date field type I'm able to set additional grouping option in grouping configuration dialog (by Day, by Week, by Month, by Quarter, by Year, by Day of Month, by Upcoming)
    How can I get and set this information in list grid in code?

    #2
    Hi mrh174,

    what is the reasoning behind this? Why not let the client compute it every time?
    If you really need it in the DB and it is functional dependent on the date, you could use computed columns if your RDBMS supports it.

    Best regards
    Blama

    Comment


      #3
      The reason is: client want to have this feature ;)

      I just debugged SmartClient code and found an answer.

      I found that I can access this information like this:

      listGrid.getField("dateFieldName").getGroupingMode()

      Anyway, Thanks for your answer.

      Comment


        #4
        If you want to store the group-state of some grid and restore it later, getGroupState() would allow you to do that - its result includes information like groupingMode.

        Comment


          #5
          Ah sorry, I misunderstood. I thought you wanted to get and save the grouping result *per record*, which would not have made much sense.
          I did the same (also for visible fields and sorting), you can find the code you could use as starting point here.

          Best regards
          Blama

          Comment

          Working...
          X