-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Events
Desislava Mihaylova edited this page Apr 28, 2016
·
2 revisions
The Events section shows all events supported by a widget or component. Document the event arguments. Include at least the sender field. Also mention in the event description that:
"The event handler function context (available via the this keyword) will be set to the widget instance."
Here is an example of event definition:
### columnShow
Fired when the user shows a column.
The event handler function context (available via the `this` keyword) will be set to the widget instance.
#### Event Data
##### e.column `Object`
A JavaScript object which represents the [column](#configuration-columns) configuration.
##### e.sender `kendo.ui.Grid`
The widget instance which fired the event.
#### Example - subscribe to the "columnShow" event during initialization
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
columnMenu: true,
columnShow: function(e) {
console.log(e.column.field); // displays the field of the hidden column
}
});
</script>
#### Example - subscribe to the "columnShow" event after initialization
<div id="grid"></div>
<script>
function grid_columnShow(e) {
console.log(e.column.field); // displays the field of the hidden column
}
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
columnMenu: true
});
var grid = $("#grid").data("kendoGrid");
grid.bind("columnShow", grid_columnShow);
</script>
Events are defined in a ### section. Event arguments are listed as ##### sections similar to configuration options. There should be a #### Event Data section if the event has any event arguments. If there are no event arguments don't add such a section.
The event description must start with "Fired". Use "fired" instead of "triggered" or "raised".
Markdown Fundamentals
- Markdown Basics (Official GitHub Documentation)
- GitHub Flavored Markdown (Official GitHub Documentation)
Kendo UI Core API Documentation