Announcement

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

    Trouble with eventId as the primary key for Calendar

    Abstract: I want to display events in the calendar that have 3 primary keys of type String. However, the samples for the calendar always show to set "eventId" as the one and only primary key. Is there a workaround?

    Details of my solution:
    - I have a client only data source for the calendar (I load events from my gears database).
    - I override all the dialogs for the calendar with my own versions of event editors (as shown in a couple of threads in this forum)
    - I've set DataSourceSequenceField for eventId NOT to be a primary key. Therefore I have no primary key at all.

    My assumptions:
    - I thought that since I'm using my own versions of event editing/adding window, my code can get around the 'one integer primary key' problem because I get the whole CalendarEvent on the input of calendar event editing method
    - I thought that setting eventId = 1 for all calendar events would work

    The difficulties:
    - The calendar displays all events in the upper left corner of the calendar window completely ignoring the date setting for events

    The analysis:
    - I've read the Javadoc for DataSourceField.setPrimaryKey() where it is written to map the keys in DataSource.transformResponse(). The problem is that it's impossible to do stateless one-to-one mapping (String,String,String)<=>integer in general (by stateless I mean not holding a stateful mapping table for the lifetime of my application)

    The questions:
    - Is it true that the only way to get around this problem is to implement statefull mapping table mentioned above?
    - Can I just sequentially number the events on every call to DataSource.getClientOnlyResponse()? The javadoc for DataSourceField.setPrimaryKey() says that eventId should be unique for the lifetime of the page. I don't know how to exatly interpret this. I don't know if the GUI does not cache the ids somewhere between getClientOnlyResponse() call.
    - Maybe it is simpler for Isomorphic to make a simple change in the calendar so that it does not glue all the events in the left upper corner?

    #2
    I've had events display in the upper left corner before and it shouldn't have anything to do with the event id. It usually happens with events that start and end at the exact same time and so have no duration. Or sometimes it will happen if the event ends before it starts, although sometimes that will display in other weird ways. I also had it happen with one event that ended 3 days after it started although that doesn't seem to happen every time.

    The event id is not particularly important, but you shouldn't set them all to the same id. If you don't care about id just increment a variable and use that for the id so that they are all unique.

    Comment

    Working...
    X