0

I have a list of work orders that I am dropping into a Full Calendar. I need to have access to the work order's primary key so that I can update it's record in my MySQL database. So, I have simply added the work order's primary key to the title of the calendar event. Then, as I drop an event onto the calendar, the drop event parses the HTML and grabs the work order's primary key, storing it in the event itself for later use.

The problem is that this is ugly! I don't want the primary key on the event both because it's ugly and because it takes up too much space.

How do I include the primary key of my record in my list of items to be be added to the calendar, but not actually display these primary keys? I have tried adding a <div style="visibility:hidden"> to the list items, but that only hides the HTML when the item is in the list. As soon as I drop it onto the calendar, the <div> becomes visible again.

Any ideas?

4

1 回答 1

1

There have been various answers to this. Myself, I just use event.id = primary key (assuming it is an int or reasonable string, see EvObj); then when responding to callbacks like eventClick(ev,...), for instance, you can retrieve it as ev.id and update your DB accordingly. That way you don't need to mess your events' titles or add strange hidden elements.

----- Addendum:

If using event.id causes conflicts with repeating events, the EvObj can also have custom properties, like event.dbid.

As for the other problem, to hide the dbid somewhere in the list of <div> that were to be dropped in the calendar, using jQuery data is a clean way to do it.

于 2013-01-09T01:27:31.147 回答