2

enter image description here

I need to display status column value. when only the checkbox checked row in kendo grid angular. here the code

 <kendo-grid [data]="gridData" [navigable]="true" [selectable]="{ mode: 'single' }">
          <kendo-grid-column field="Discontinued" title="" width="20">
            <ng-template kendoGridCellTemplate let-dataItem>
                <input type="checkbox" (click)="toggle(dataItem, 'Discontinued')" [checked]="dataItem.Discontinued"/>
            </ng-template>
        </kendo-grid-column>
        
        <kendo-grid-column field="ProductName" title="Units" [width]="30"></kendo-grid-column>
          
           <kendo-grid-column field="Discontinued" title="status" [width]="30"></kendo-grid-column>
     </kendo-grid>

TS:

  public toggle(dataItem: any, field: string): void {
  
   dataItem[field] =  'primary';
  }

above primay value need to given statically. when unchecked the status value still showing the primary value. I need display status value only checked when unchecked don't display any value. please help me

code sample here

1
  • Have you checked my answer and tried it? Commented Apr 5, 2021 at 11:39

1 Answer 1

3

In order to keep it simple and follow the way you implemented it, try to change the toggle method like that:

public toggle(dataItem: any, field: string): void {
  if (dataItem[field] === 'primary') {
    dataItem[field] =  '';
  }
  else {
    dataItem[field] =  'primary';
  }
}

Please find the updated code and result

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.