-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Timeline override items #2284
Timeline override items #2284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Thank you for this addition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost perfect! Very nice! Thanks!
@simo9000 Maybe you change the comments I added and update your branch!?
docs/timeline/index.html
Outdated
| <td class="ident">editable.overrideItems</td> | ||
| <td>boolean</td> | ||
| <td><code>false</code></td> | ||
| <td>If true, item specific editable properties are overridden</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe more precise: "If true, item specific editable properties are overridden by timeline settings" or something similar!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good
docs/timeline/index.html
Outdated
| <td>If true, items can be dragged to another moment in time. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td> | ||
| </tr> | ||
| <tr parent="editable" class="hidden"> | ||
| <td class="ident">editable.overrideItems</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must be class="indent"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
| updateGroup: true, // drag items from one group to another | ||
| remove: true // delete an item by tapping the delete button top right | ||
| } | ||
| };</pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here in this code example the new option overrideItems is missing. Should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good catch.
docs/timeline/index.html
Outdated
|
|
||
| <p> | ||
| Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option. | ||
| Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option depending on the value of <code>timeline.editable.overrideItems</code>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...will override the timeline option depending on the value of
timeline.editable.overrideItems.
I would propose:
...will override the timeline option except timeline.editable.overrideItems is set to true.
| <p>Specify individual items to be editable or readonly. Toggle edit options and override behavior from timeline.editable</p> | ||
|
|
||
| <div id="visualization"></div> | ||
| <form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe wrap the form in a <p> to get some space between the form and the timeline!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no problem
| {id: 6, content: 'Read-only', editable: false, start: '2010-08-29', group: 2}, | ||
| {id: 7, content: 'Editable', editable: true, start: '2010-08-31', end: '2010-09-03', group: 1}, | ||
| {id: 8, content: 'Read-only', editable: false, start: '2010-09-04T12:00:00', group: 2}, | ||
| {id: 9, content: 'Null', start: '2010-09-04', group: 1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, Null looks too much like undefined. What about something generic like foo and bar or default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default works
|
|
||
| if ('editable' in options) { | ||
| if (typeof options.editable === 'boolean') { | ||
| this.options.editable.updateTime = options.editable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😠 That's why I don't like these code-indent-formatting-thinks. (I hope we get rid of them in the future).
@simo9000 No problem here, just a comment...
|
Thanks for the feedback. I updated the branch as you suggested. |
|
@simo9000 Thanks again! Feel free to contribute more! We always need good developers that help keeping this project alive. |
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided * Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item * Updated Documentation to reflect the new feature * Updated the individualEditableItems example page to show feature usage.
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided * Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item * Updated Documentation to reflect the new feature * Updated the individualEditableItems example page to show feature usage.
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided * Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item * Updated Documentation to reflect the new feature * Updated the individualEditableItems example page to show feature usage.
* Fixed bug introduced in #2284 where overrideItems is set to true when boolean is provided * Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item * Updated Documentation to reflect the new feature * Updated the individualEditableItems example page to show feature usage.
This is a continuation of #2256. I have implemented a sub-option to
timeline.editablecalledoverrrideItemswhich provides a means to switch between two precedence conventions, 1.item.editableand 2.timeline.editable.item.editable; (current behavior*) - this convention allows theitem.editableoption to override the values oftimeline.editable.timeline.editable- this convention allows the timeline options to override the item options when 'overrideItems' is set to true. This is useful when switching an entire timeline between "editing" and "read-only" modes while still enforcing individualitem.editableoptions during "editing" mode.To preserve backward capability
timeline.editable.overrideItemsdefaults to false which enables convention 1. This PR includes documentation updates and a new example page wheretimeline.editableoptions can be toggled to easily test different configurations. A test matrix was created and used to confirm the behavior. Bugs fixed in 8ae5d2a and d2899c1 were found as a result of this exhaustive testing.*currently the setting
item.editable = trueoverridestimeline.editable.removeandtimeline.editable.updateTimebut does not overridetimeline.editable.updateGroupwhich is inconsistent with the documentation. The bugs found in matrix testing were split into two commits to separate fixes that do not impact this behavior (8ae5d2a) and an update to makeitem.editable = trueoverride all behaviors (d2899c1). This makes it easy to revert d2899c1 if needed as this commit has the potential to impact backward compatibility.