Drag to create(拖拽创建)¶
:::callout{theme="neutral"} This page describes drag to create for the Scheduling Gantt Chart widget. For setting up drag to create for the Calendar widget, see Drag to create. :::
Enable end users to create new schedule objects on demand using drag to create. Drag to create allows you to initialize a new schedule object on a particular row, at a "dragged from" and "dragged to" start and end timestamp.
In order to configure drag to create, you must provide a Create Action Type. On drag and drop of a puck, the widget will call this action.
In the example below, we will refer to the schedule layer as Object type A.
Set up drag-to-create behavior¶
- In Ontology Manager, navigate to
Object type Aand create aCreate Action Type. This action type should have the following parameters: - The primary key for your new object
- The
Start Timestampproperty - The
End Timestampproperty - The
foreign keyproperty - Optionally, add properties that you want to be filled out on object creation.
- In the end, the action type should be configured such that inputting a
Start Timestamp,End Timestamp, andforeign keywill create an object ofobject type Awith those values. - Now, in Workshop, navigate to Input Data (Pucks) > [your schedule layer] > Interactions > Drag Cursor to Create Action.
- Under Drag to Create Action, select the action type you configured.
- Under the action type you just inputted, choose Select parameter to configure and select the start timestamp, end timestamp, and foreign key parameters. You should now see these three parameters listed in the configuration. We will now select scheduling Gantt variables to pre-fill these parameter values.
- For the Start Timestamp parameter, under Local Default Value, select SELECTED START TIMESTAMP in the popup to ensure that, on drag to create, the widget automatically passes in the timestamp that you have dragged from.
- For the End Timestamp parameter, under Local Default Value, select SELECTED END TIMESTAMP in the popup. This will ensure that, on drag to create, the widget automatically passes in the timestamp that you have dragged to.
- For the foreign key parameter, under Local Default Value, select RESOURCE ID in the popup to ensure that, on drag to create, the widget automatically passes in the row (resource) that you have triggered drag to create on.
Use¶
Once set up, Shift + Drag on a given row from a start and end time. This will trigger a popup of your drag to create action form. Upon submission, a new schedule object will be created for the specified row, incorporating the start and end timestamps from the "dragged from" and "dragged to" actions.

中文翻译¶
拖拽创建¶
:::callout{theme="neutral"} 本页介绍调度甘特图组件的拖拽创建功能。如需为日历组件设置拖拽创建,请参阅拖拽创建。 :::
允许最终用户通过拖拽创建功能按需生成新的调度对象。拖拽创建可让用户在特定行上,基于"拖拽起始"和"拖拽结束"的时间戳初始化新的调度对象。
要配置拖拽创建,您必须提供创建操作类型。当用户拖拽滑块时,组件将调用此操作。
以下示例中,我们将调度层称为对象类型A。
设置拖拽创建行为¶
- 在Ontology Manager中,导航至
对象类型A并创建一个创建操作类型。该操作类型应包含以下参数: - 新对象的主键
开始时间戳属性结束时间戳属性外键属性- 可选:添加希望在对象创建时填写的其他属性
- 最终,该操作类型应配置为:输入
开始时间戳、结束时间戳和外键后,即可创建包含这些值的对象类型A对象。 - 在Workshop中,导航至输入数据(滑块)> [您的调度层] > 交互 > 拖拽光标以创建操作。
- 在拖拽创建操作下,选择您配置的操作类型。
- 在刚输入的操作类型下方,选择选择要配置的参数,然后依次选择开始时间戳、结束时间戳和外键参数。此时您应看到这三个参数已列在配置中。接下来,我们将选择调度甘特图变量来预填充这些参数值。
- 对于开始时间戳参数,在本地默认值下的弹出菜单中选择选定的开始时间戳,以确保拖拽创建时组件自动传入您拖拽起始的时间戳。
- 对于结束时间戳参数,在本地默认值下的弹出菜单中选择选定的结束时间戳,以确保拖拽创建时组件自动传入您拖拽结束的时间戳。
- 对于外键参数,在本地默认值下的弹出菜单中选择资源ID,以确保拖拽创建时组件自动传入您触发拖拽创建的行(资源)。
使用方式¶
设置完成后,在指定行上按住Shift + 拖拽选择起始和结束时间。这将触发拖拽创建操作表单的弹出窗口。提交后,系统将为指定行创建新的调度对象,并自动填入"拖拽起始"和"拖拽结束"操作中的时间戳。
