Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2046)

Unified Diff: Source/devtools/front_end/ui/DataGrid.js

Issue 366813006: DevTools: DataGrid: add ability to insert row in sorted tables. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/DataGrid.js
diff --git a/Source/devtools/front_end/ui/DataGrid.js b/Source/devtools/front_end/ui/DataGrid.js
index 24bb6e7156147fdf6f80d46039dcfd09fadc3f32..1a5ea10f367bdf88ea97feb6dddf436dc092d215 100644
--- a/Source/devtools/front_end/ui/DataGrid.js
+++ b/Source/devtools/front_end/ui/DataGrid.js
@@ -324,6 +324,16 @@ WebInspector.DataGrid.prototype = {
return this._rootNode;
},
+ /**
+ * @param {!WebInspector.DataGridNode} node
+ */
+ insertChild: function(node)
+ {
+ // Currently only non-hierarchical tables are supported.
+ var parentNode = this._rootNode;
+ parentNode.insertChild(node, parentNode.children.upperBound(node, this._sortingFunction));
+ },
+
_ondblclick: function(event)
{
if (this._editing || this._editingNode)
@@ -846,6 +856,7 @@ WebInspector.DataGrid.prototype = {
sortedRows.sort(comparatorWrapper);
var sortedRowsLength = sortedRows.length;
+ this._rootNode.children = [];
tbody.removeChildren();
var previousSiblingNode = null;
for (var i = 0; i < sortedRowsLength; ++i) {
@@ -854,6 +865,7 @@ WebInspector.DataGrid.prototype = {
node.previousSibling = previousSiblingNode;
if (previousSiblingNode)
previousSiblingNode.nextSibling = node;
+ this._rootNode.children.push(node);
tbody.appendChild(row);
previousSiblingNode = node;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698