Announcement

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

    Questions about databound Timeline

    Hi there, trying to get my head around the Timeline component and have some questions:


    We're trying to create a schedule-thingy, so we have a scheduleitem datasource pointing to location and user datasources.

    I therefor want the "lanes" to be the users just like in your examples, but obviously, when jumping forward and back in time which users that have schedule items will differ.

    I have found no way of defining a "lane" datasource. To me something like that would make sense, something akin to an optiondatasource for form field drop downs.


    I do not know at creation time (like in your examples) what the lanes might be when i change the time period, so how do i go about making the lanes dynamic?

    Pointers much appreciated, i'm sure i've misunderstood something.

    #2
    There's no current facility to supply lanes via a dataSource - although we'd consider adding one via the Feature Sponsorship program, if you need it.

    In the meantime, you could fetch *all* lanes via a DS, apply them to the timeline, and then setHideUnusedLanes(true) - that should refilter the lane-set whenever the range changes, and show only lanes that have reachable events.

    Note that the current implementation of the hideUnusedLanes feature may be too slow if you have a large number of events - a better implementation is in the roadmap for future versions.

    Comment


      #3
      Hey Iso thanks for quick response.

      OK, i see. The other alternative, i guess, would be to do something like "grouping" in listgrids, i.e. just specify which field is the "lane field" and have the schedule items appear on a specific lane based on that line field.

      I see two functions that i'm not sure how they differ, first there is
      "setLaneNameField(String laneNameField)"
      and then there is
      "setLaneFields(ListGridField... laneFields)"

      If i want to "group" (i mean lanes are just grouping right?) my scheduleitems based on the username, will it be enough to call setLaneNameField("userName")

      Comment


        #4
        What you're describing appears to be exactly what already happens.

        laneFields are those frozen fields that appear to the left of the scrollable timeline.

        Calendar.laneNameField is the name of a field in each CalendarEvent that maps to the "name" attribute of some Lane object.

        If you want to do *actual* grouping (of lanes, not of events), take a look at the doc for Calendar.canGroupLanes and groupByLaneField - note that you can only group lanes by one of the provided laneFields.

        Comment


          #5
          Right, but from my testing here it isn't enough just to set "setlanenamefield" and then the lane rows are created based on the calendar events data? I also must specify what the possible lane row values are via setlanefields, or?

          It would be great if i could just specify the name for the lane field, for example "userName", and then the lane rows were created from the calendar events based on the different values for "userName" for each calendar event.

          From what i can see from the examples you do this by making two calls with the same dataset:

          Code:
          calendar.setData(TimelineData.getRecords());  
          calendar.setLanes(TimelineLaneData.getRecords());
          It would be great if the "setLanes" call wasn't needed, and instead that the Timeline could figure out which rows were needed based on the data fetched.

          Please let me know if i have misunderstood something.

          Comment


            #6
            Those two data-sets are not the same - one contains events, the other lanes.

            Anyway, this is not currently a supported feature - as we said, we would consider adding such facilities via the Feature Sponsorship program.

            Comment


              #7
              I understand they're not the same, i'm just saying that one could be derived from the other, just like grouping in listgrids. But thanks, now i know i'll have to do it myself somehow.

              OK, I actually have one more question!

              When you create the calendar component, you set the "initial date", and there's a period selector (the one with arrows) above the timeline.

              However, i don't see that the period chosen is used anywhere? My datasource is configured to call a custom spring service, and there are no parameters sent in the criteria that i can use in order to fetch events matching the time period.

              Comment


                #8
                Although Calendar (and Timeline) is a DataBoundComponent, it is not yet as fully featured as other DBCs. For example, it does not support progressive loading of event-data as a user moves around in a view.

                In vertical Calendar views, all data is pre-loaded by the Calendar, and then manipulated by the individual views. Fetches with criteria are not expected in these views.

                However, for Timelines, we should indeed be initiating fetches when the visible range changes - it looks like this (internal) feature has been switched during the deep rework that took place for Calendars and Timelines for 5.0.

                You should be able to switch it on in your app with code like this:

                Code:
                timeline.setAttribute("fetchMode", "timeline");
                We'll address that in the coming days - not necessarily by exposing this feature (which is internal because it is incomplete).

                Comment


                  #9
                  Hey, thanks for responding.

                  I'm not sure i get what you mean. To me the timeline works like this:

                  An initial period is set. The datasource is called to fetch data for the timeline. The fetch-call should contain the period chosen, so that the correct data set can be fetched. When you change the time in the timeline, new data should be fetched, and the new period should be sent in as criteria in order to fetch the correct data.
                  Since i do not see any start- end period dates being sent to the server, i don't see how i can fetch the correct event data on the server without me having to do additional coding.


                  It would be great if you could confirm the following:

                  1. In order to make use of the timeline, i will have to "setinitialcriteria" since i need to add the criteria for the initial period myself, in order for dates to be sent to the server for fetching.

                  2. In order to fetch new data whenever the user changes the time period, i will need to somehow add a listener to the time-period component and make a fetchdata-call myself, again creating criteria to pass the dates along.


                  Finally, again, i dont understand why you say that "Fetches with criteria are not expected" in the calendar, surely date period is applicable for the calendar component aswell?
                  Last edited by mathias; 1 Aug 2015, 04:29.

                  Comment


                    #10
                    No, that's not the case.

                    To make use of the timeline, you just give it a range. As it stands right now, timelines still work just fine, they just pre-load all the data.

                    As we said, this is wrong, and timelines should be doing automatically what you describe in your points 1 and 2 - they used to do that, and we will fix the code shortly so that they do so again.

                    In the meantime, as we already said, you can call setAttribute("fetchMode", "timeline") on your Timeline, and that should get range-based fetching working for you again.

                    As for data being loaded by range in other Calendar views - this is not expected behavior - not because it would be a *bad* behavior, but because that has never been the way the calendar component works. All data has always been loaded up front, except for Timelines.

                    Enhanced DataBoundComponent features exist in the future roadmap for Calendars, but there are no fixed ETAs - if you need this feature in some near-future time-scale, consider sponsoring it.

                    Comment


                      #11
                      First, many thanks for responding, this is a great thread :)

                      What i don't understand now is the notion of "fetching all data".

                      What if you have calendar events for hundreds of users, for several years? This could be many thousands of rows, that you surely don't want to fetch at once. To me, it's the other way around that is "bad" behaviour, if you see what i mean.


                      OK, my outstanding question is this - if the component is supposed to work as you say, will it then call my datasource server-side with start- and enddates as criteria added into the DSRequest? If that's the case, then yeah, it would work for me. Right now, even the autofetch-call does not include any date parameters server-side that i can see.

                      Comment


                        #12
                        Did you add that call to setAttribute()? If not, then no, it isn't going to work.

                        As we said - the practice of loading all data up front is a *legacy* behavior - it has always worked that way. No, it does not lend itself very well to enormous datasets, yes, there are better mechanisms for doing it and, yes, these mechanisms are noted and in the wishlist as alternate APIs in future releases.

                        We can't really continue to repeat that point.

                        We've reinstated range-based fetching for Timelines - please retest with a build dated August 3 or later.

                        Comment


                          #13
                          Hey there, tried the build from the 3:rd and it does seem to pass in dates now!

                          I had wished that it wouldn't be so complex to get the dates out (advancedcriteria with lessthan, greaterthan etc), but it works. As Borat would say - Great success.


                          (not sure what you meant with "cant really continue to repeat that point", i haven't seen you mentioning that up-front-loading was legacy behaviour anywhere else in this thread. No need to get defensive, just trying to understand.)


                          Thanks again for your input and help.

                          Comment

                          Working...
                          X