Fixed data table view bugs: collapsed columns should now stay collapsed even if the column model changes.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@266 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
e008332399
commit
0160b6841d
@ -288,18 +288,29 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
||||
{
|
||||
label: "Collapse This Column",
|
||||
click: function() {
|
||||
theProject.columnModel.columns[self._columnIndex].collapsed = true;
|
||||
self._dataTableView._collapsedColumnNames[self._column.name] = true;
|
||||
self._dataTableView.render();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Collapse All Other Columns",
|
||||
click: function() {
|
||||
var collapsedColumnNames = {}
|
||||
for (var i = 0; i < theProject.columnModel.columns.length; i++) {
|
||||
if (i != self._columnIndex) {
|
||||
theProject.columnModel.columns[i].collapsed = true;
|
||||
collapsedColumnNames[theProject.columnModel.columns[i].name] = true;
|
||||
}
|
||||
}
|
||||
self._dataTableView._collapsedColumnNames = collapsedColumnNames;
|
||||
self._dataTableView.render();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "Collapse All Columns To Left",
|
||||
click: function() {
|
||||
for (var i = 0; i < self._columnIndex; i++) {
|
||||
self._dataTableView._collapsedColumnNames[theProject.columnModel.columns[i].name] = true;
|
||||
}
|
||||
self._dataTableView.render();
|
||||
}
|
||||
},
|
||||
@ -307,7 +318,7 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
||||
label: "Collapse All Columns To Right",
|
||||
click: function() {
|
||||
for (var i = self._columnIndex + 1; i < theProject.columnModel.columns.length; i++) {
|
||||
theProject.columnModel.columns[i].collapsed = true;
|
||||
self._dataTableView._collapsedColumnNames[theProject.columnModel.columns[i].name] = true;
|
||||
}
|
||||
self._dataTableView.render();
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ function DataTableView(div) {
|
||||
this._div = div;
|
||||
this._pageSize = 20;
|
||||
this._showRecon = true;
|
||||
this._collapsedColumnNames = {};
|
||||
|
||||
this._initializeUI();
|
||||
this._showRows(0);
|
||||
@ -190,9 +191,9 @@ DataTableView.prototype.render = function() {
|
||||
var td = trHead.insertCell(trHead.cells.length);
|
||||
$(td).addClass("column-header");
|
||||
|
||||
if (column.collapsed) {
|
||||
if (column.name in self._collapsedColumnNames) {
|
||||
$(td).html(" ").attr("title", column.name).click(function(evt) {
|
||||
column.collapsed = false;
|
||||
delete self._collapsedColumnNames[column.name]
|
||||
self.render();
|
||||
});
|
||||
} else {
|
||||
@ -253,7 +254,7 @@ DataTableView.prototype.render = function() {
|
||||
for (var i = 0; i < columns.length; i++) {
|
||||
var column = columns[i];
|
||||
var td = tr.insertCell(tr.cells.length);
|
||||
if (column.collapsed) {
|
||||
if (column.name in self._collapsedColumnNames) {
|
||||
td.innerHTML = " ";
|
||||
} else {
|
||||
var cell = (column.cellIndex < cells.length) ? cells[column.cellIndex] : null;
|
||||
|
Loading…
Reference in New Issue
Block a user