Non-Editable field still editable in popup

2 posts, 0 answers
  1. Joe
    Joe avatar
    220 posts
    Member since:
    May 2012

    Posted 31 Jan 2017 Link to this post

    I have a grid where I have several fields set as non-editable, but when the popup editor displays, those fields are included in the popup editor, and are in fact editable.  How can I disable the editing of certain fields wfor the popup editor?  I'm already setting it to false in the Model definition.

    @(Html.Kendo().Grid<UploadedDocument>()
          .Name("docResults")
          .TableHtmlAttributes(new { @class = "table-condensed" })
          .Columns(cols =>
          {
              cols.Bound(c => c.Id).Width(35).ClientTemplate("<input type=\"checkbox\" />");
              cols.Bound(c => c.DocketNumber);
              cols.Bound(c => c.CaseId);
              cols.Bound(c => c.Type);
              cols.Bound(c => c.ClientId);
              cols.Bound(c => c.EmployeeId);
              cols.Bound(c => c.SSN);
              cols.Bound(c => c.LastName);
              cols.Bound(c => c.FirstName);
              cols.Bound(c => c.Name).Title("Document");
              cols.Command(c => c.Edit());
          })
          .Resizable(r => r.Columns(true))
          .Scrollable(s => s.Height("auto"))
          .Sortable()
          .Pageable(p => p
              .Refresh(true)
              .PageSizes(new List<object> { 10, 20, 30, 40, 50, "all" })
              .ButtonCount(10))
          .Filterable(f => f.Enabled(true))
          .Events(ev => ev.DataBound("gridBound"))
          .AutoBind(true)
          .DataSource(ds => ds
              .Ajax()
              .PageSize(20)
              .ServerOperation(false)
              .Model(m =>
              {
                  m.Id(d => d.Id);
                  m.Field(d => d.DocketNumber);
                  m.Field(d => d.CaseId);
                  m.Field(d => d.Type);
                  m.Field(d => d.ClientId);
                  m.Field(d => d.EmployeeId);
                  m.Field(d => d.SSN);
                  m.Field(d => d.LastName);
                  m.Field(d => d.FirstName);
                  m.Field(d => d.Name).Editable(false);
              })
              .Read(r => r.Action("GetSearchResults", "Document",
                    new { docketNumber = @Model.DocketNumber,
                        ssnNumber = @Model.SSNNumber,
                        lastName = @Model.LastName,
                        firstName = @Model.FirstName,
                        caseID = @Model.CaseId,
                        garnishType = @Model.GarnishType,
                        clientID = @Model.ClientId }).Type(HttpVerbs.Get))
              .Update(u => u.Action("EditInline", "Document"))
              .Events(e => e.Error("error_handler"))
          )
          .ToolBar(tb => tb.Custom().Text("Clear Filter").HtmlAttributes(new { id = "gridFilterReset", style = "float:right;" }))
          .Editable(e => e.Mode(GridEditMode.PopUp))
        )

     

    I have the Name field set as not being editable, but in the popup I can still edit it...  I'd actually prefer the non-editable fields to not even show up in the popup edit screen.  Is there a way to do this?

  2. Joe
    Joe avatar
    220 posts
    Member since:
    May 2012

    Posted 31 Jan 2017 Link to this post

    I took the shortcut route, and instead of relying on the built-in popup editor, I created my own editor template.  Works for me, for now.

     

    Consider this answered.

Back to Top