Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// within widget _create()
- tihs.dataTable = this.$dataTable.dataTable({
- order: [[1, "asc"]],
- columns: [
- {
- data: null,
- orderable: false,
- defaultContent: "",
- createdCell: this._createExpandCell.bind(this)
- },
- // ...
- // data columns
- // ...
- {
- data: null,
- orderable: false,
- defaultContent: "",
- createdCell: this._createControlCell.bind(this)
- }
- ],
- serverSide: true,
- deferLoading: 0,
- ajax: function (data, callback, settings) {
- DemoDataService.GetData("Snapshots", callback, data);
- }.bind(this)
- });
- /// widget methods
- _createExpandCell: function (cell, cellData, rowData, rowIndex, colIndex) {
- $(cell)
- .append($("<span></span>")
- .ExpandButton({
- isExpanded: false,
- expanded: function() {
- let dataTableRow = this.dataTable.api().row(rowIndex);
- if (dataTableRow.child() == null) {
- dataTableRow.child("<div></div>").show();
- dataTableRow.child().children().html("FACTS TABLE PENDING");
- }
- else {
- dataTableRow.child.show();
- }
- }.bind(this),
- collapsed: function () {
- this.dataTable.api().row(rowIndex).child.hide();
- }.bind(this)
- }));
- },
- _createControlCell: function (cell, cellData, rowData, rowIndex, colIndex) {
- $(cell)
- .append($("<span></span>")
- .button({
- text: false,
- icons: {
- primary: "ui-icon-pencil"
- }
- })
- .click(function () {
- Dialogs.EditSnapshot.Open(rowData, function (event, result) {
- if ((result.result === "save") || (result.result === "retake"))
- this.dataTable.api().row(rowIndex).data(result.snapshot);
- }.bind(this));
- }.bind(this)));
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement