| Index: tracing/tracing/ui/base/table.html
|
| diff --git a/tracing/tracing/ui/base/table.html b/tracing/tracing/ui/base/table.html
|
| index 0a52a8f8ba507b1cc663caf94ce828e6f40a6290..e845202c99f57802430c7161bdda92aba5b2f797 100644
|
| --- a/tracing/tracing/ui/base/table.html
|
| +++ b/tracing/tracing/ui/base/table.html
|
| @@ -232,6 +232,7 @@ tr.exportTo('tr.ui.b', function() {
|
| this.emptyValue_ = undefined;
|
| this.subRowsPropertyName_ = 'subRows';
|
| this.customizeTableRowCallback_ = undefined;
|
| + this.sortable_ = true;
|
| },
|
|
|
| ready: function() {
|
| @@ -258,6 +259,7 @@ tr.exportTo('tr.ui.b', function() {
|
| this.headerCells_ = [];
|
| this.subRowsPropertyName_ = 'subRows';
|
| this.defaultExpansionStateCallback_ = undefined;
|
| + this.sortable_ = true;
|
| },
|
|
|
| get showHeader() {
|
| @@ -307,6 +309,17 @@ tr.exportTo('tr.ui.b', function() {
|
| this.scheduleRebuildBody_();
|
| },
|
|
|
| + get sortable() {
|
| + return this.sortable_;
|
| + },
|
| +
|
| + set sortable(sortable) {
|
| + this.sortable_ = !!sortable;
|
| + if (!sortable)
|
| + this.sortColumnIndex_ = undefined;
|
| + this.scheduleRebuildHeaders_();
|
| + },
|
| +
|
| /**
|
| * Data objects should have the following fields:
|
| * mandatory: title, value
|
| @@ -407,6 +420,9 @@ tr.exportTo('tr.ui.b', function() {
|
| return;
|
| }
|
|
|
| + if (!this.sortable_)
|
| + return undefined;
|
| +
|
| if (this.tableColumns_.length <= number)
|
| throw new Error('Column number ' + number + ' is out of bounds.');
|
| if (!this.tableColumns_[number].cmp)
|
| @@ -485,7 +501,7 @@ tr.exportTo('tr.ui.b', function() {
|
|
|
| // If the table can be sorted by this column, attach a tap callback
|
| // to the column.
|
| - if (this.tableColumns_[i].cmp) {
|
| + if (this.sortable_ && this.tableColumns_[i].cmp) {
|
| Polymer.dom(td).classList.add('sensitive');
|
| headerCell.tapCallback = this.createSortCallback_(i);
|
| // Set arrow position, depending on the sortColumnIndex.
|
| @@ -725,6 +741,14 @@ tr.exportTo('tr.ui.b', function() {
|
| var isExpandable = rowInfo.userRow[this.subRowsPropertyName_] &&
|
| rowInfo.userRow[this.subRowsPropertyName_].length;
|
|
|
| + function getTD(cur) {
|
| + if (cur === trElement)
|
| + throw new Error('woah');
|
| + if (cur.parentElement === trElement)
|
| + return cur;
|
| + return getTD(cur.parentElement);
|
| + }
|
| +
|
| if (isSelectable || isExpandable) {
|
| trElement.addEventListener('click', function(e) {
|
| e.stopPropagation();
|
| @@ -735,14 +759,6 @@ tr.exportTo('tr.ui.b', function() {
|
| return;
|
| }
|
|
|
| - function getTD(cur) {
|
| - if (cur === trElement)
|
| - throw new Error('woah');
|
| - if (cur.parentElement === trElement)
|
| - return cur;
|
| - return getTD(cur.parentElement);
|
| - }
|
| -
|
| // If the row/cell can be selected and it's not selected yet,
|
| // select it.
|
| if (isSelectable && this.selectionMode_ !== SelectionMode.NONE) {
|
| @@ -778,6 +794,16 @@ tr.exportTo('tr.ui.b', function() {
|
| }.bind(this));
|
| }
|
|
|
| + if (isSelectable && this.selectionMode_ !== SelectionMode.NONE) {
|
| + trElement.addEventListener('dblclick', function(e) {
|
| + e.stopPropagation();
|
| + var event = new tr.b.Event('selection-entered');
|
| + event.row = rowInfo.userRow;
|
| + event.columnIndex = getTD(e.target).columnIndex;
|
| + this.dispatchEvent(event);
|
| + }.bind(this));
|
| + }
|
| +
|
| return rowInfo.htmlNode;
|
| },
|
|
|
|
|