bugfix
This commit is contained in:
parent
6e2514a57d
commit
1793498b3f
@ -72,6 +72,30 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
this.container.bind('max_threshold', this.load_next_page.bind(this));
|
||||
await this.render();
|
||||
}
|
||||
build_title(){
|
||||
var w = new bricks.Title3({
|
||||
otext:this.title,
|
||||
i18n:true,
|
||||
wrap:true,
|
||||
dynsize:true,
|
||||
halign:'left'
|
||||
});
|
||||
this.add_widget(w);
|
||||
}
|
||||
build_description(){
|
||||
var w = new bricks.Text({
|
||||
otext:this.description,
|
||||
i18n:true,
|
||||
wrap:true,
|
||||
dynsize:true,
|
||||
halign:'left'
|
||||
});
|
||||
this.add_widget(w);
|
||||
}
|
||||
build_toolbar(){
|
||||
this.toolbar_w = new bricks.IconTextBar(this.toolbar);
|
||||
this.add_widget(this.toolbar_w);
|
||||
}
|
||||
async build_header(){
|
||||
this.header_w = await this.build_item();
|
||||
this.add_widget(this.header_w);
|
||||
@ -150,7 +174,11 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
content.show();
|
||||
f.bind('submited', this.add_record_finish.bind(this, info));
|
||||
}
|
||||
add_record_finish(info,record){
|
||||
async add_record_finish(info, event){
|
||||
var resp = event.params;
|
||||
var desc = await resp.json();
|
||||
var w = await bricks.widgetBuild(desc);
|
||||
console.log(resp, desc, w);
|
||||
var content = info.parent.children[1];
|
||||
content.hide();
|
||||
this.render();
|
||||
@ -173,7 +201,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
"fields":fields
|
||||
});
|
||||
content.add_widget(f, 0);
|
||||
f.bind('submited', this.update_record_finish.bind(this, info, content, hided, f));
|
||||
f.bind('submited', this.update_record_finish.bind(this, info, content, f));
|
||||
f.bind('cancel', this.update_cancel.bind(this, info, content));
|
||||
content.show();
|
||||
}
|
||||
@ -181,12 +209,14 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
content.clear_widgets();
|
||||
content.hide();
|
||||
}
|
||||
async update_record_finish(info, content, hided, form){
|
||||
var d = form.getValue();
|
||||
async update_record_finish(info, content, form, event){
|
||||
content.remove_widget(form);
|
||||
if (hided){
|
||||
content.hide();
|
||||
}
|
||||
var resp = event.params;
|
||||
var desc = await resp.json();
|
||||
var w = await bricks.widgetBuild(desc);
|
||||
if (desc.widgettype == 'Message'){
|
||||
var d = form.getValue();
|
||||
var record = bricks.extend(info.data, d);
|
||||
var w = info.children[0];
|
||||
info.clear_widgets();
|
||||
@ -195,6 +225,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
||||
w.add_widget(rtb, 0);
|
||||
info.add_widget(w);
|
||||
}
|
||||
}
|
||||
delete_record(info, record){
|
||||
var conform_w = new bricks.Conform({
|
||||
target:this,
|
||||
|
@ -147,7 +147,7 @@ bricks.Form = class extends bricks.VBox {
|
||||
return
|
||||
}
|
||||
if (params.name == 'submit'){
|
||||
this.validation(this);
|
||||
this.validation();
|
||||
} else if (params.name == 'cancel'){
|
||||
this.cancel();
|
||||
} else if (params.name == 'reset'){
|
||||
@ -189,9 +189,9 @@ bricks.Form = class extends bricks.VBox {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
async validation(form){
|
||||
async validation(){
|
||||
var data = this.getValue();
|
||||
form.dispatch('submit', data);
|
||||
this.dispatch('submit', data);
|
||||
if (this.submit_url){
|
||||
var rc = new bricks.HttpResponse();
|
||||
var resp = await rc.httpcall(this.submit_url,
|
||||
@ -199,7 +199,7 @@ bricks.Form = class extends bricks.VBox {
|
||||
method:this.method || 'POST',
|
||||
params:data
|
||||
});
|
||||
form.dispatch('submited', resp);
|
||||
this.dispatch('submited', resp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user