This commit is contained in:
yumoqing 2024-05-21 18:56:27 +08:00
parent ce49858187
commit c3e8e499ac

View File

@ -88,8 +88,9 @@ bricks.TreeNode = class extends bricks.VBox {
this.trigle.bind('state_changed', this.toggleExpandCollapse.bind(this)); this.trigle.bind('state_changed', this.toggleExpandCollapse.bind(this));
widget.add_widget(this.trigle); widget.add_widget(this.trigle);
} }
if (this.tree.checkable){ if (this.tree.checkField){
this.check_w = new bricks.Check({name:'check'}); var v = this.user_data[this.tree.checkField];
this.check_w = new bricks.UiCheck({name:'check', value:v});
widget.add_widget(this.check_w); widget.add_widget(this.check_w);
this.check_w.bind('changed', this.tree.node_checked.bind(this.tree, this)) this.check_w.bind('changed', this.tree.node_checked.bind(this.tree, this))
} }
@ -388,12 +389,14 @@ bricks.Tree = class extends bricks.VScrollPanel {
async node_checked(node, event){ async node_checked(node, event){
var cb = event.target.bricks_widget; var cb = event.target.bricks_widget;
var stat = cb.getValue().check; var stat = cb.getValue().check;
node.user_data[this.checkField] = stat;
var d = { var d = {
node:node, node:node,
data:node.getValue(), data:node.getValue(),
id: node.get_id(), id: node.get_id(),
check_stat:stat check_stat:stat
} }
console.log('value=', cb.getValue(), 'node=', node);
this.dispatch('check_changed', d); this.dispatch('check_changed', d);
} }
node_info_log(event){ node_info_log(event){