I need to create a custom subpanel-list.php view but I want to replace the inline edit option
'event' => 'list:editrow:fire',
to go to the record detail edit view.
I need to create a custom subpanel-list.php view but I want to replace the inline edit option
'event' => 'list:editrow:fire',
to go to the record detail edit view.
For anyone else looking for the solution, this is what I did, it just changes the click action to redirect the page to edit url.
({
extendsFrom: 'RecordlistView',
initialize: function (options) {
app.view.invokeParent(this, {type: 'view', name: 'recordlist', method: 'initialize', args: [options]});
this.context.off('list:editrow:fire');
this.context.on('list:editrow:fire',this.fullEdit,this);
},
fullEdit:function(event,model){
location.href='#'+this.module+'/'+event.id+'/edit';
},
});
If you would rather open the editor in a popout drawer you can replace the fullEdit function with something like this.
drawerEdit: function(model) {
var self = this;
var pref_id = model.get('id');
var module = self.module;
var parentRecord = app.data.createBean(module, {id: pref_id});
parentRecord.fetch({
success: function (data) {
//populate the fields
model.set('field_1',data.get('field_1'));
model.set('field_2',data.get('field_2'));
model.set('field_3',data.get('field_3'));
app.drawer.open({
layout:'create',
context:{
create: true,
model: model,
module:'<subpanel_module_name>',
}
});
}
});
Nice post Brad, that is useful.