- Which of the following do you prefer?
- Which is easier to read?
- Which is easier to write?
- Which is easier to maintain?
var dataItem = this.target().closest(".k-grid").data("kendoGrid").dataSource.getByUid(this.target().closest("tr").data("uid"));
Or…
var dataItem = this.target() .closest(".k-grid") .data("kendoGrid") .dataSource .getByUid(this.target().closest("tr").data("uid"));
Or…
var grid = this.target().closest(".k-grid").data("kendoGrid"); var dataSrc = grid.dataSource; var dataItem = dataSrc.getByUid(this.target().closest("tr").data("uid"));
I’m not convinced the answers are obvious.
4 Responses to Programming Style–Kendo & jQuery