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));
|
this.container.bind('max_threshold', this.load_next_page.bind(this));
|
||||||
await this.render();
|
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(){
|
async build_header(){
|
||||||
this.header_w = await this.build_item();
|
this.header_w = await this.build_item();
|
||||||
this.add_widget(this.header_w);
|
this.add_widget(this.header_w);
|
||||||
@ -150,7 +174,11 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
|||||||
content.show();
|
content.show();
|
||||||
f.bind('submited', this.add_record_finish.bind(this, info));
|
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];
|
var content = info.parent.children[1];
|
||||||
content.hide();
|
content.hide();
|
||||||
this.render();
|
this.render();
|
||||||
@ -173,7 +201,7 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
|||||||
"fields":fields
|
"fields":fields
|
||||||
});
|
});
|
||||||
content.add_widget(f, 0);
|
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));
|
f.bind('cancel', this.update_cancel.bind(this, info, content));
|
||||||
content.show();
|
content.show();
|
||||||
}
|
}
|
||||||
@ -181,19 +209,22 @@ bricks.DynamicAccordion = class extends bricks.VScrollPanel {
|
|||||||
content.clear_widgets();
|
content.clear_widgets();
|
||||||
content.hide();
|
content.hide();
|
||||||
}
|
}
|
||||||
async update_record_finish(info, content, hided, form){
|
async update_record_finish(info, content, form, event){
|
||||||
var d = form.getValue();
|
|
||||||
content.remove_widget(form);
|
content.remove_widget(form);
|
||||||
if (hided){
|
content.hide();
|
||||||
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();
|
||||||
|
var rtb = w.children[0];
|
||||||
|
var w = await bricks.widgetBuild(this.record_view, info, record);
|
||||||
|
w.add_widget(rtb, 0);
|
||||||
|
info.add_widget(w);
|
||||||
}
|
}
|
||||||
var record = bricks.extend(info.data, d);
|
|
||||||
var w = info.children[0];
|
|
||||||
info.clear_widgets();
|
|
||||||
var rtb = w.children[0];
|
|
||||||
var w = await bricks.widgetBuild(this.record_view, info, record);
|
|
||||||
w.add_widget(rtb, 0);
|
|
||||||
info.add_widget(w);
|
|
||||||
}
|
}
|
||||||
delete_record(info, record){
|
delete_record(info, record){
|
||||||
var conform_w = new bricks.Conform({
|
var conform_w = new bricks.Conform({
|
||||||
|
@ -147,7 +147,7 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (params.name == 'submit'){
|
if (params.name == 'submit'){
|
||||||
this.validation(this);
|
this.validation();
|
||||||
} else if (params.name == 'cancel'){
|
} else if (params.name == 'cancel'){
|
||||||
this.cancel();
|
this.cancel();
|
||||||
} else if (params.name == 'reset'){
|
} else if (params.name == 'reset'){
|
||||||
@ -189,9 +189,9 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
async validation(form){
|
async validation(){
|
||||||
var data = this.getValue();
|
var data = this.getValue();
|
||||||
form.dispatch('submit', data);
|
this.dispatch('submit', data);
|
||||||
if (this.submit_url){
|
if (this.submit_url){
|
||||||
var rc = new bricks.HttpResponse();
|
var rc = new bricks.HttpResponse();
|
||||||
var resp = await rc.httpcall(this.submit_url,
|
var resp = await rc.httpcall(this.submit_url,
|
||||||
@ -199,7 +199,7 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
method:this.method || 'POST',
|
method:this.method || 'POST',
|
||||||
params:data
|
params:data
|
||||||
});
|
});
|
||||||
form.dispatch('submited', resp);
|
this.dispatch('submited', resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user