How can I access custom data fields in this function?
The Timeline does just ignores custom fields, and there is no easy way to access them. Usable item properties in the function customStackOrder
are the actual position and size (left
, right
, width
, height
) and timestamps (start
and optionally end
).
If you really want to do this, you will have to apply an inefficient hack. This is not officially supported and I don't recommend it:
- From the items passed to the sorting function you will have to determine their table index:
var indexA = mytimeline.items.indexOf(itemA)
- Read the data of this item from your original data table:
var dataA = data[indexA]
. - Read your custom field from this:
var stackOrderA = dataA.stackOrder
Edit:
Another trick could be: if you don't use the field className
, you could misuse this to hold the value of your stackOrder
field. Just ensure the values cannot collide with some actual css.