bugfix
This commit is contained in:
parent
e39214e606
commit
f2cfc34aaf
@ -166,6 +166,20 @@ bricks.Tree = class extends bricks.VScrollPanel {
|
||||
this.create_node_children(this, this.opts.data);
|
||||
}
|
||||
create_toolbar(){
|
||||
var toolbar = bricks.extend({}, this.toolbar);
|
||||
var tools = [];
|
||||
toolbar.tools.forEach(f => tools.push(f));
|
||||
if (this.editable){
|
||||
tools.push({icon:bricks_resource('imgs/add.png'), name:'add'});
|
||||
tools.push({icon:bricks_resource('imgs/update.png'), name:'update'});
|
||||
tools.push({icon:bricks_resource('imgs/delete.png'), name:'delete'});
|
||||
}
|
||||
toolbar.tools = tools;
|
||||
this.toolbar_w = new bricks.IconBar(toolbar);
|
||||
this.add_widget(this.toolbar_w);
|
||||
this.toolbar_w.bind('add', this.add_new_node.bind(this));
|
||||
this.toolbar_w.bind('delete', this.delete.bind(this));
|
||||
this.toolbar_w.bind('update', this.update_node.bind(this));
|
||||
}
|
||||
async get_children_data(node){
|
||||
var jcall = bricks.jcall;
|
||||
@ -186,15 +200,22 @@ bricks.Tree = class extends bricks.VScrollPanel {
|
||||
}
|
||||
}
|
||||
node_click_handle(node, event){
|
||||
if (this.selected_node){
|
||||
if (this.selected_node == node){
|
||||
this.selected_node.selected(false);
|
||||
this.selected_node = node;
|
||||
} else {
|
||||
if (this.selected_node){
|
||||
this.selected_node.selected(false);
|
||||
}
|
||||
this.selected_node = node;
|
||||
node.selected(true);
|
||||
this.dispatch('node_selected', node);
|
||||
}
|
||||
this.selected_node = node;
|
||||
node.selected(true);
|
||||
this.dispatch('node_click', node);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
在数控件中提供增删改能力
|
||||
*/
|
||||
bricks. EditableTree = class extends bricks.Tree {
|
||||
/*
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user