function setup_checkboxes(tags) {
var tree = document.getElementById('checkbox-tree');
- var ctags = tree.columns.getLastColumn();
+ var check = tree.columns.getFirstColumn();
+ var name = tree.columns.getPrimaryColumn();
+ tree.view.setCellText(1,name,'Johnny');
+ var v = 'false';
for (var row=0; row<tree.view.rowCount; row++) {
- p = tree_path(tree, row);
- tree.view.origSetCellValue(row, ctags, tag_in_tags(p, tags));
+ var p = tree_path(tree, row);
+ if (tag_in_tags(p, tags)) {
+ v = 'true';
+ } else {
+ v = 'false';
+ }
+ tree.view.nonHookedSetCellValue(row, check, v);
+ //alert([p, tags, tag_in_tags(p, tags), tree.view.getCellValue(row, ctags)].join());
}
- tree.treeBoxObject.invalidateColumn(ctags);
+ tree.treeBoxObject.invalidateColumn(check);
+ tree.builder.rebuild();
+ alert('cbxs,'+tree.view.rowCount+','+tree.view.getCellValue(1,check));
}
/* Functions driving the CherryPy backend */
/* The bindings themselves */
function initialize() {
+ alert('hi');
document.getElementById('element').file_path = 'UNDEFINED';
var tree = document.getElementById('checkbox-tree');
tree.view.origSetCellValue = tree.view.setCellValue;
- tree.view.setCellValue = function (row, col, value) {
+ tree.view.origGetCellValue = tree.view.getCellValue;
+ tree.view.checkbox_data = new Array();
+ tree.view.nonHookedSetCellValue = function (row, col, value) {
tree.view.origSetCellValue(row, col, value);
+ tree.view.checkbox_data[row] = value;
+ //alert('set: '+[row, col, value].join());
+ };
+ tree.view.setCellValue = function (row, col, value) {
+ tree.view.nonHookedSetCellValue(row, col, value);
checkbox_activity(tree, row, col, value);
};
+ tree.view.getCellValue = function (row, col) {
+ return 'true';
+ var v;
+ if (row in tree.view.checkbox_data) {
+ v = tree.view.checkbox_data[row];
+ } else {
+ v = tree.view.origGetCellValue(row, col);
+ }
+ alert('get: '+[row, col, v].join());
+ return v;
+ }
}
function new_tag_button() {
var text = document.getElementById('new-tag-text').value;
- new_tag(text.split('/'));
+ setup_checkboxes([['q']]);
+ //new_tag(text.split('/'));
}
function set_selected_element(path, tags, id) {