1

Is there any way to select a grid row from code so you can trigger the selectionChange event emitter? I don't know how to get hold of the grid component and execute the event manually.

Selection grid sample plunkr

<kendo-grid [data]="gridView" [selectable]="true"></kendo-grid>

--

Edit: If I access the grid manually by adding a #gridReference tag into the kendo-grid tag, I can access the component using

@ViewChild('activityGrid') gridReference: GridComponent;

But when executing

var selectionEvent = { index: 0, selected: false } as SelectionEvent;  
this.gridReference.selectionChange.emit(selectionEvent);

It still doesn't work. It migth work when I have to access the SelectionService using unselect but that's a private class.

Updated plunkr

2
  • I don't know if this would work for your purposes, but I give a hacky 'solution' for selecting a row here. Commented Jan 11, 2017 at 21:05
  • not really, just want a simple angular2 / api way to keep it clean :) Commented Jan 11, 2017 at 21:38

2 Answers 2

1

This could be achieved now by utilizing the new SelectionDirective. It allows specifying the key to be stored when selecting a row and also the selectedKeys collection to hold reference to the selected keys. This also allows to programatically modify the selection.

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

Comments

0

Unfortunately, currently it is not possible to select a row programmatically via the public API.

The selectionChange emitter is there to trigger the selectionChange event and I'm afraid it will not trigger the selection logic.

5 Comments

are you going to implement selection method in feature?
Yes, we will. The selection API will be expanded in order to support more advanced selection modes we are planning.
any update on this? I cannot pass in a selection that I wanna be highlighted?
Is there any news on these changes. I would like to see the SelectionEvent to pass along the target from the selectable.directive. I would like to be able to easily popup details over the grid based on the target location. I'm getting the target manually based on the passed in index but seems like this would be a simple change to the SelectionEvent object and directive. It's a nice library I just wish it was open source so the community could help out.
I just found this link for requested features. It says the grid select should be coming in September release. Kendo Features

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.