在Coevery CMS中,我正在尝试从父记录创建新的子记录。父母通过一对多关系与孩子相关。有一个“新”按钮,但当我点击它没有任何反应。
该按钮存在于Coevery.Relationships - >视图 - > RelatedEntityList.cshtml
以下是RelatedEntityList.cshtml
@using Coevery.Relationship
@using Coevery.Relationship.Records
@using Coevery.Relationship.ViewModels
@{
var relationships = (IList<RelatedEntityViewModel>)Enumerable.Cast<RelatedEntityViewModel>(Model.Relationships);
}
@foreach (var relationship in relationships) {
<section class="row-fluid related-list">
<header>
<h5>@relationship.Label</h5>
<div class="btn-toolbar">
<button class="btn btn-small btn-success"> // <-- No action here
<i class="icon-plus"></i> New
</button>
</div>
</header>
<div data-ng-controller='RelatedEntityListCtrl' data-ng-init="relationId='@relationship.RelationId';relationType='@relationship.RelationType';entityTypeName='@relationship.RelatedEntityName';viewId=@relationship.ProjectionId;getRelatedData()">
<div data-ag-grid="gridOptions" data-ag-grid-name="referenceList"></div>
</div>
</section>
}
我可以注意到该按钮没有任何操作,但我相信它应该打开该关系中子实体的Create页面。但是,我不确定如何修复代码来做到这一点。
可以找到完整的Coevery代码here
答案 0 :(得分:0)
我在按钮中添加了以下代码,以便能够在父页面中创建新的子实体:
<button class="btn btn-small btn-success" data-ng-controller='RelatedEntityListCtrl' data-ng-click="add()" data-ng-init="relationId='@relationship.RelationId';relationType='@relationship.RelationType';entityTypeName='@relationship.RelatedEntityName';viewId=@relationship.ProjectionId">
<i class=" icon-plus">
</i> New
</button>