bugfix
This commit is contained in:
parent
88a34ba271
commit
e903fe9b4a
@ -244,7 +244,6 @@ body {
|
||||
.accordion-item {
|
||||
border: 1px solid #ccc;
|
||||
margin-bottom: 5px;
|
||||
width: auto;
|
||||
}
|
||||
.accordion-item-header {
|
||||
padding: 10px;
|
||||
|
@ -7,11 +7,15 @@ bricks.DataRow = class extends bricks.HBox {
|
||||
]
|
||||
fields:[]
|
||||
css
|
||||
browser_excloud_fields:[]
|
||||
edit_excloud_fields:[],
|
||||
|
||||
header_css
|
||||
}
|
||||
*/
|
||||
constructor(opts){
|
||||
super(opts);
|
||||
// this.set_style('flexShrink', '0');
|
||||
}
|
||||
render_header(editable, checkable){
|
||||
this.render(editable, checkable, true);
|
||||
@ -78,6 +82,7 @@ bricks.DataRow = class extends bricks.HBox {
|
||||
toolbar.tools = tools;
|
||||
var w = new bricks.IconBar(toolbar);
|
||||
this.add_widget(w);
|
||||
this.toolbar_w = w;
|
||||
this.event_names = []
|
||||
for(var i=0;i<tools.length;i++){
|
||||
if (tools[i].name != 'blankicon'){
|
||||
@ -85,11 +90,9 @@ bricks.DataRow = class extends bricks.HBox {
|
||||
w.bind(tools[i].name, this.my_dispatch(tools[i].name));
|
||||
}
|
||||
}
|
||||
console.log('this.event_names=', this.event_names);
|
||||
}
|
||||
|
||||
my_dispatch(e){
|
||||
console.log('DataRow(): dispatch event', e);
|
||||
this.dispatch(e);
|
||||
}
|
||||
build_fields(header){
|
||||
|
@ -1,5 +1,5 @@
|
||||
var bricks = window.bricks || {};
|
||||
bricks.AccordionItem = class extends bricks.FVBox {
|
||||
bricks.AccordionItem = class extends bricks.VBox {
|
||||
constructor(opts){
|
||||
super(opts);
|
||||
this.set_css('accordion-item');
|
||||
|
@ -82,12 +82,16 @@ bricks.BaseModal = class extends bricks.Layout {
|
||||
this.dispatch('opened');
|
||||
}
|
||||
dismiss(){
|
||||
this.dom_element.style.display = "none";
|
||||
this.target_w.remove_widget(this);
|
||||
this.set_css('display', 'none');
|
||||
if (this.timeout_task){
|
||||
this.timeout_task.cancel();
|
||||
this.timeout_task = null;
|
||||
}
|
||||
try {
|
||||
this.target_w.remove_widget(this);
|
||||
} catch(e){
|
||||
console.log(e, 'remove modal error');
|
||||
}
|
||||
this.dispatch('dismissed');
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ var bricks = window.bricks || {};
|
||||
bricks.Tabular = class extends bricks.DynamicAccordion {
|
||||
constructor(opts){
|
||||
super(opts);
|
||||
this.fields = this.record_view.fields;
|
||||
this.fields = this.record_view.options.fields;
|
||||
}
|
||||
async build_info(item, record){
|
||||
if (this.record_view.widgettype != 'DataRow'){
|
||||
@ -12,31 +12,48 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
|
||||
if (record){
|
||||
/* data row
|
||||
*/
|
||||
console.log('debug -------', this.record_view, record);
|
||||
var options = bricks.extend({}, this.record_view.options);
|
||||
var fields = [];
|
||||
options.fields.forEach(f => {
|
||||
var newf = bricks.extend({}, f);
|
||||
newf.value = record[f.name];
|
||||
fields.push(newf);
|
||||
});
|
||||
var desc = bricks.extend({}, this.record_view);
|
||||
var opts = bricks.extend({}, this.record_view.options);
|
||||
opts.user_data = record;
|
||||
desc.options = opts;
|
||||
var dr = await bricks.widgetBuild(desc, this,record);
|
||||
options.fields = fields;
|
||||
options.user_data = record;
|
||||
desc.options = options
|
||||
var dr = await bricks.widgetBuild(desc, this);
|
||||
dr.render(this.editable, this.checkable, false);
|
||||
dr.bind('update', this.update_record.bind(this, dr, record));
|
||||
dr.bind('delete', this.delete_record.bind(this, dr, record));
|
||||
dr.event_names.forEach(e => {
|
||||
console.log('e=', e, 'record=', record);
|
||||
dr.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
||||
dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
||||
});
|
||||
} else {
|
||||
var dr = await bricks.widgetBuild(this.record_view, this);
|
||||
dr.render(this.editable, this.checkable, true);
|
||||
dr.bind('add', this.add_record.bind(this, dr, record));
|
||||
console.log('datarow=', dr);
|
||||
dr.event_names.forEach(e => {
|
||||
dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
||||
});
|
||||
}
|
||||
item.add_widget(dr);
|
||||
return dr;
|
||||
}
|
||||
record_event_handle(event_name, record, row, item){
|
||||
console.log('event_name=', event_name, 'record=', record);
|
||||
switch(event_name){
|
||||
case 'add':
|
||||
this.add_record(row, record);
|
||||
break;
|
||||
case 'update':
|
||||
this.update_record(row, record);
|
||||
break;
|
||||
case 'delete':
|
||||
this.delete_record(row, record);
|
||||
break;
|
||||
default:
|
||||
this.dispatch(event_name, record);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user