简体   繁体   中英

Kendo-grid in Angular 6: isEditing: how?

I'm trying to get whether or not the Kendo-grid is in its "editing stage". I found this documentation which tells me that it's possible , however I can't seem to find out how to use that. It's not possible to use like this:

<kendo-grid [data]="gridData" (isEditing)="isEditing($event)"> (...) </kendo-grid>

That way, the function never gets called.
I'm probably not completely awake yet. Could someone give me a hand? Do I need to get an instance of the kendo-grid and run a function on that instance? And if so, how?

isEditing is a method on the grid component not an event.

So basically you need to have a reference to your grid and then you can call the method for example in the toolbar template to show some text:

   <kendo-grid
       #grid
       [data]="gridData">
       <ng-template kendoGridToolbarTemplate>
            <span *ngIf="grid.isEditing()">A row is being edited</span>
       </ng-template>

       <kendo-grid-column
           field="UnitPrice"
           title="Unit Price"
           [width]="180"
           format="{0:c}">
       </kendo-grid-column>

       <kendo-grid-column
           field="Discontinued"
           title="Discontinued"
           [width]="100">
       </kendo-grid-column>
   </kendo-grid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM