Back to Devexpress

SelectionChangedEvent Class

aspnetcore-js-devexpress-dot-richedit-1e8caf82.md

latest2.7 KB
Original Source

SelectionChangedEvent Class

An event that occurs when selection is changed in the document.

Declaration

ts
export class SelectionChangedEvent extends RichEditEvent<EventArgs>

Remarks

You can define the SelectionChanged event handler either at the server side, at the client side, or at runtime.

Use the OnSelectionChanged(String) method to specify the event handler.

cshtml
@(Html.DevExpress().RichEdit("richEdit")
 .OnSelectionChanged("function(s,e) {console.log('The current position is ' + s.selection.active);}")
 // ...

Use the selectionChanged property to specify the event handler.

javascript
const options = DevExpress.RichEdit.createOptions();
options.events.selectionChanged = function(s,e) {
  console.log('The current position is ' + s.selection.active);
};

The selectionChanged property provides access to the addHandler(handler), removeHandler(handler), and clearHandlers methods that allow you to dynamically add and remove event handlers.

javascript
richEdit.events.selectionChanged.addHandler(function(s, e) {
  console.log('The current position is ' + s.selection.active);
});

The event handler receives an argument of the EventArgs type.

Inherited Members

addHandler(handler)

clearHandlers

isEmpty

removeHandler(handler)

Inheritance

Event<TSource, TEventArgs> RichEditEvent<TEventArgs> SelectionChangedEvent

See Also

Client-Side Events