Disable editing for certain rows

Posted by: johngiblin on 2 April 2020, 6:23 am EST

    • Post Options:
    • Link

    Posted 2 April 2020, 6:23 am EST

    I wanted to be able to disable certain rows from being able to be editable.

    I tried the following, where I have a field called isDetail and I use the stopEditing when the status is beforeStartEditing. That doesnt seem to work

    private editingDataView(sender: any, args: any): void {

    if (args.oldItem.isDetail === false) {
      if (args.status === 'beforeStartEditing') {
          this.dataView.stopEditing();
      }
      return;
    }
    
  • Posted 2 April 2020, 6:24 am EST

    [author]johngiblin[/author]I wanted to be able to disable certain rows from being able to be editable.

    I tried the following, where I have a field called isDetail and I use the stopEditing when the status is beforeStartEditing. That doesnt seem to work

    private editingDataView(sender: any, args: any): void {

        if (args.oldItem.isDetail === false) {
          if (args.status === 'beforeStartEditing') {
              this.dataView.stopEditing();
          }
          return;
        }
    
  • Posted 2 April 2020, 5:49 pm EST

    Hi John,

    You need to set the cancel property to true for beforeStartEditing edit event.Please refer to the following code snippet and the sample demonstrating the same:

    dataView.editing.addHandler(function(e) {
      if (e.status === 'beforeStartEditing' && !e.oldItem.isDetail) {
        e.cancel = true;
      }
    });
    

    Regards Sharad

  • Posted 6 April 2020, 12:18 am EST

    Thanks Sharad. that worked!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels