首页 > 解决方案 > 用于 Asp.Net MVC 的 Telerik UI 无法在可排序中编辑输入项

问题描述

一旦我将可排序对象添加到容器中,就无法编辑任何输入元素:

    <ul class="kt-portlet__body no-bullets" id="UnitEditor">

<li>
    @using (Html.BeginCollectionItem("Units"))
    {
        <div data-id="@Model.UnitId" id="@Model.UnitId" class="row editorRow" style="padding-bottom: 10px;">
            @Html.HiddenFor(x => x.UnitId)
            @Html.HiddenFor(x => x.SortIndex, new { id = "SortIndex" })
            <div class="col-md-3">
                <label class="kt-popover kt-font-bold" data-toggle="kt-popover" data-placement="top" data-trigger="hover" data-html="true" data-content="The name of the Unit that will be displayed. (Max-Length:150)">Unit Name</label>
                @Html.TextBoxFor(x => x.UnitName, new { @class = "form-control" })
            </div>
            @if (ViewBag.isSiteAdmin)
            {
                <div class="col-md-2">
                    <label class="kt-popover" data-toggle="kt-popover" data-placement="top" data-trigger="hover" data-html="true" data-content="Select the Competency Type which will determine the scope of usage.">Competency Type</label>
                    @Html.DropDownListFor(x => x.CompetencyTypeId, new SelectList(Model.competencyTypeSelect, "Id", "Text"), "Select Type", new { @class = "form-control", data_competencyType = Model.UnitId })
                </div>
                <div id="CompanySelectDiv_@Model.UnitId" class="col-md-2" style="@(Model.CompetencyTypeId == 2 ? "" : "display: none;")">
                    <label class="kt-popover" data-toggle="kt-popover" data-placement="top" data-trigger="hover" data-html="true" data-content="Select the Company specific to this Unit.">Company</label>
                    @Html.DropDownListFor(x => x.CompanyId, new SelectList(Model.companySelect, "Id", "Text"), "Select Company", new { @class = "form-control", data_company = Model.UnitId })
                </div>
            }
            else
            {
                @Html.HiddenFor(x => x.CompetencyTypeId)
                @Html.HiddenFor(x => x.CompanyId)
            }
            <div class="col-md-2">
                <label class="kt-popover kt-font-bold" data-toggle="kt-popover" data-placement="top" data-trigger="hover" data-html="true" data-content="The minimum Score required to avoid additional training.">Gap Closure Threshold</label>
                @Html.TextBoxFor(x => x.GapClosureThreshold, new { @class = "form-control", @type = "number", id = "GapClosureThreshold" })
            </div>
            <div class="col-md-2" style="text-align: center;">
                <label class="kt-popover kt-font-bold" data-toggle="kt-popover" data-placement="top" data-trigger="hover" data-html="true" data-content="The number of Evidences for this Unit.">Evidence Count</label>
                <br />
                @Html.DisplayTextFor(x => x.NumEvidences)
            </div>
            <div class="col-xl-1" style="padding-top: 22px;">
                @if (Model.UnitId < 0)
                {
                    <a class="editRow" style="cursor: pointer; padding-top: 20px;"><i title="Edit Unit" class="lnir lnir-pencil-alt" style="font-size: medium;"></i></a>
                    <a onclick="$(this).parent().parent().remove();" style="cursor: pointer; padding-top: 20px;"><i title="Remove new Unit" class="lnir lnir-trash-can-alt-1" style="font-size: medium;"></i></a>
                }
                else
                {
                    <a class="editRow" style="cursor: pointer; padding-top: 20px;"><i title="Edit Unit" class="lnir lnir-pencil-alt" style="font-size: medium;"></i></a>
                    <a class="deleteRow" style="cursor: pointer; padding-top: 20px;"><i title="Remove Unit from Assessment" class="lnir lnir-trash-can-alt-1" style="font-size: medium;"></i></a>
                }
                @if (Model.Evidences != null)
                {
                    if (Model.Evidences.Count > 0)
                    {
                        for (int i = 0; i < Model.Evidences.Count; i++)
                        {
                            @Html.HiddenFor(m => m.Evidences[i].UnitId)
                            @Html.HiddenFor(m => m.Evidences[i].EvidenceId)
                            @Html.HiddenFor(m => m.Evidences[i].Description)
                            @Html.HiddenFor(m => m.Evidences[i].ResponseTypeId)
                            @Html.HiddenFor(m => m.Evidences[i].Active)
                        }
                    }
                }
            </div>

        </div>
    }

</li>

</ul>
@if (Model.AssessmentId != -1)
{
    @(Html.Kendo().Sortable()
        .For("#UnitEditor")
        .PlaceholderHandler("placeholder")
        .Events(events => events.Change("onSort"))
    )
}

标签: telerik-mvc

解决方案


推荐阅读