编辑
图表提供了编辑选项,使您能够向其添加工具和形状,并使用其布局选项。
开始
要启用图的编辑功能:
为远程CRUD操作配置数据源。您必须包含模型声明。的
Id
是必须的,以指示哪个字段是唯一标识符。.DataSource(d => d .ShapeDataSource() .Model(m => {m.Id(s => s.Id);m.Field(s => s.Id).Editable(false);m.Field(s => s. jobtitle);m.Field(s => s. color);}) .Read("ReadShapes", "DiagramData") .Create("CreateShape", "DiagramData") .Destroy(" destroeshape ", "DiagramData") .Update("UpdateShape", "DiagramData"))
< hierarchy -datasource server-operation="false" type="DataSourceTagHelperType. "Ajax"> < hierarchy -model id=" id ">< fields> hierarchy -datasource>hierarchy -model> 配置
ConnectionsDataSource
用于远程CRUD操作。不设置ConnectionsDataSource
,编辑被禁用。.ConnectionsDataSource(d => d .Model(m => {m.Id(c => c.Id));m.Field(c => c. id).Editable(false);m.Field(c => c. text).Editable(false);m.From(c => c. fromshapeid);m.To(c => c. toshapeid);m.FromX(c => c. frompointx);m. from (c => c. frompoint);m.x x (c => c. topointx);m.ToY(c => c. topointy);}) .Read("ReadConnections", "DiagramData") .Create("CreateConnection", "DiagramData") .Destroy("DestroyConnection", "DiagramData") .Update("UpdateConnection", "DiagramData"))
< field name="id" editable="false" type="number">
模型领域
形状模型提供了以下字段:
id
(数字)-必填字段。表示形状的唯一标识符。一个没有角的形状id
字段将不被连接。类型
(字符串)-形状类型。文本
(字符串)-形状文本。x
(数量)- - -x
形状的位置。y
(数量)- - -y
形状的位置。宽度
(数字)-形状宽度。高度
(数字)-形状高度。
每个模型字段在用户交互时得到更新。