Added items show without refreshing.
The title column is by default the only one visible.
This commit is contained in:
parent
72a2dd9216
commit
a75fb2ddb6
|
@ -19,8 +19,6 @@ Scholar.TreeView.prototype.setTree = function(treebox)
|
||||||
var newRows = Scholar.Items.getTreeRows();
|
var newRows = Scholar.Items.getTreeRows();
|
||||||
for(var i = 0; i < newRows.length; i++)
|
for(var i = 0; i < newRows.length; i++)
|
||||||
this._showItem(newRows[i], 0, i+1); //item ref, isContainerOpen, level
|
this._showItem(newRows[i], 0, i+1); //item ref, isContainerOpen, level
|
||||||
|
|
||||||
this.rowCount = this._dataItems.length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Scholar.TreeView.prototype.getCellText = function(row, column)
|
Scholar.TreeView.prototype.getCellText = function(row, column)
|
||||||
|
@ -97,7 +95,6 @@ Scholar.TreeView.prototype.toggleOpenState = function(row)
|
||||||
}
|
}
|
||||||
this._dataItems[row][1] = !this._dataItems[row][1]; //toggle container open value
|
this._dataItems[row][1] = !this._dataItems[row][1]; //toggle container open value
|
||||||
|
|
||||||
this.rowCount = this._dataItems.length;
|
|
||||||
this._treebox.rowCountChanged(row+1, count); //tell treebox to repaint these
|
this._treebox.rowCountChanged(row+1, count); //tell treebox to repaint these
|
||||||
this._treebox.invalidateRow(row);
|
this._treebox.invalidateRow(row);
|
||||||
this._treebox.endUpdateBatch();
|
this._treebox.endUpdateBatch();
|
||||||
|
@ -112,15 +109,15 @@ Scholar.TreeView.prototype.selectionChanged = function()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
removeDynamicRows();
|
removeDynamicRows(dynamicBox);
|
||||||
document.getElementById('tb-edit').hidden = true;
|
document.getElementById('tb-edit').hidden = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Scholar.TreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); }
|
Scholar.TreeView.prototype._showItem = function(item, level, beforeRow) { this._dataItems.splice(beforeRow, 0, [item, false, level]); this.rowCount++; }
|
||||||
|
|
||||||
Scholar.TreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); }
|
Scholar.TreeView.prototype._hideItem = function(row) { this._dataItems.splice(row,1); this.rowCount--; }
|
||||||
|
|
||||||
Scholar.TreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; }
|
Scholar.TreeView.prototype._getItemAtRow = function(row) { return this._dataItems[row][0]; }
|
||||||
Scholar.TreeView.prototype.isSorted = function() { return false; }
|
Scholar.TreeView.prototype.isSorted = function() { return false; }
|
||||||
|
@ -171,7 +168,6 @@ Scholar.TreeView.prototype.deleteSelection = function()
|
||||||
|
|
||||||
//remove row from tree
|
//remove row from tree
|
||||||
this._hideItem(rows[i]-i);
|
this._hideItem(rows[i]-i);
|
||||||
this.rowCount--;
|
|
||||||
this._treebox.rowCountChanged(rows[i]-i, -1);
|
this._treebox.rowCountChanged(rows[i]-i, -1);
|
||||||
}
|
}
|
||||||
this._treebox.endUpdateBatch();
|
this._treebox.endUpdateBatch();
|
||||||
|
@ -185,7 +181,7 @@ Scholar.DragObserver.drop = function(row, orient) { }
|
||||||
|
|
||||||
function viewSelectedItem()
|
function viewSelectedItem()
|
||||||
{
|
{
|
||||||
removeDynamicRows();
|
removeDynamicRows(dynamicBox);
|
||||||
|
|
||||||
var thisItem = myTreeView._getItemAtRow(myTreeView.selection.currentIndex);
|
var thisItem = myTreeView._getItemAtRow(myTreeView.selection.currentIndex);
|
||||||
|
|
||||||
|
@ -246,7 +242,7 @@ function editItem(thisItem)
|
||||||
document.getElementById('list-pane').hidden = true;
|
document.getElementById('list-pane').hidden = true;
|
||||||
document.getElementById('edit-pane').hidden = false;
|
document.getElementById('edit-pane').hidden = false;
|
||||||
|
|
||||||
removeDynamicRows();
|
removeDynamicRows(dynamicBox);
|
||||||
var fieldNames = getFullFieldList(thisItem);
|
var fieldNames = getFullFieldList(thisItem);
|
||||||
|
|
||||||
for(var i = 0; i<fieldNames.length; i++)
|
for(var i = 0; i<fieldNames.length; i++)
|
||||||
|
@ -270,35 +266,13 @@ function editItem(thisItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DISABLE EDITING OF CREATORS UNTIL WE COME UP WITH A GOOD METHOD
|
|
||||||
var beforeField = dynamicBox.firstChild.nextSibling;
|
|
||||||
|
|
||||||
for (var i=0,len=thisItem.numCreators(); i<len; i++)
|
|
||||||
{
|
|
||||||
var creator = thisItem.getCreator(i);
|
|
||||||
|
|
||||||
var label = document.createElement("label");
|
|
||||||
label.setAttribute("value","Creator:");
|
|
||||||
label.setAttribute("control","dynamic-creator-"+i);
|
|
||||||
|
|
||||||
var valueElement = document.createElement("textbox");
|
|
||||||
valueElement.setAttribute("value",creator.lastName+", "+creator.firstName);
|
|
||||||
valueElement.setAttribute("id","dynamic-field-"+i);
|
|
||||||
|
|
||||||
var row = document.createElement("row");
|
|
||||||
row.appendChild(label);
|
|
||||||
row.appendChild(valueElement);
|
|
||||||
|
|
||||||
dynamicBox.insertBefore(row, beforeField);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
itemBeingEdited = thisItem;
|
itemBeingEdited = thisItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeDynamicRows()
|
function removeDynamicRows(box)
|
||||||
{
|
{
|
||||||
while(dynamicBox.hasChildNodes())
|
while(box.hasChildNodes())
|
||||||
dynamicBox.removeChild(dynamicBox.firstChild);
|
box.removeChild(box.firstChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFullFieldList(item)
|
function getFullFieldList(item)
|
||||||
|
@ -319,6 +293,12 @@ function returnToTree(save)
|
||||||
for(var i=0; i<valueElements.length; i++)
|
for(var i=0; i<valueElements.length; i++)
|
||||||
itemBeingEdited.setField(valueElements[i].getAttribute("fieldName"),valueElements[i].value);
|
itemBeingEdited.setField(valueElements[i].getAttribute("fieldName"),valueElements[i].value);
|
||||||
|
|
||||||
|
if(!itemBeingEdited.getID())
|
||||||
|
{
|
||||||
|
myTreeView._showItem(itemBeingEdited, 0, myTreeView.rowCount);
|
||||||
|
myTreeView._treebox.rowCountChanged(myTreeView.rowCount-1,1);
|
||||||
|
}
|
||||||
|
|
||||||
itemBeingEdited.save();
|
itemBeingEdited.save();
|
||||||
}
|
}
|
||||||
itemBeingEdited = null;
|
itemBeingEdited = null;
|
||||||
|
|
|
@ -32,7 +32,14 @@
|
||||||
<treecol
|
<treecol
|
||||||
id="creator_column"
|
id="creator_column"
|
||||||
label="&sidebar.items.creator_column;"
|
label="&sidebar.items.creator_column;"
|
||||||
flex="1"/>
|
flex="1"
|
||||||
|
hidden="true"/>
|
||||||
|
<splitter class="tree-splitter"/>
|
||||||
|
<treecol
|
||||||
|
id="source_column"
|
||||||
|
label="&sidebar.items.source_column;"
|
||||||
|
flex="1"
|
||||||
|
hidden="true"/>
|
||||||
</treecols>
|
</treecols>
|
||||||
<treechildren/>
|
<treechildren/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -2,3 +2,7 @@
|
||||||
|
|
||||||
<!ENTITY sidebar.items.title_column "Title">
|
<!ENTITY sidebar.items.title_column "Title">
|
||||||
<!ENTITY sidebar.items.creator_column "Creator">
|
<!ENTITY sidebar.items.creator_column "Creator">
|
||||||
|
<!ENTITY sidebar.items.source_column "Source">
|
||||||
|
<!ENTITY sidebar.creators.firstname_column "First name">
|
||||||
|
<!ENTITY sidebar.creators.lastname_column "Last name">
|
||||||
|
<!ENTITY sidebar.creators.type_column "Type">
|
Loading…
Reference in New Issue
Block a user