Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
575
Disabling grid column for editing
posted

I am creating a grid with 3 columns:

      model = new GridModel();

      model.DataSource = _db.getColumnSelectGridItems();

      model.Columns.Add(new GridColumn("Column Name", "ColumnName", "string", "150"));
      model.Columns.Add(new GridColumn("Selected", "Selected", "bool", "100"));
      model.Columns.Add(new GridColumn("Filter", "Filter", "string", "150"));

I want to be able to edit both the 'Filter' and 'Selected' columns but not the 'Column Name' column.  Here's what I'm trying:

      var updating = new GridUpdating();
      updating.EnableAddRow = false;
      updating.EnableDeleteRow = false;
      updating.ColumnSettings.Add(new ColumnUpdatingSetting() { ColumnKey= "ColumnName", ReadOnly = true });

      model.Features.Add(updating);

Obviously its not working.  What am I missing?

  • 19693
    posted

    Hello danenatoli ,

    Please let me know if you need further assistance after Viktor's answer.

    The next service release is scheduled to be in the middle of September:

    http://ko.infragistics.com/support/service-releases.aspx#ServiceReleases

  • 24497
    posted

    Hi Danenatoli,

    Thank you for report.
    I tested a sample on my machine with latest version of Mvc grid and it worked correctly. Current public version has grid-updating as CTP feature and it may have some issues.
    One of the possible reasons can be mismatched name of ColumnKey property of ColumnSettings generated by Mvc and expected by jquery. While development that name was changed few times and not all places could be synchronized.

    In latest version the Mvc generates columnKey. Something like below (source of generated html):

     

    features: [ { columnSettings: [ { columnIndex: -1, columnKey: 'Title', readOnly: true } ], name: 'Updating', enableAddRow: false, enableDeleteRow: false } ]

    and jquery igGridUpdating also uses columnKey (ig.ui.grid.updating.js):

    columnSettings: [ {
        columnKey: null,
        editorType: null,
        editorOptions: null,
        required: null,
        readOnly: null,
        validation: null,
        defaultValue: null
    } ],