I want to create a view of case/matter entity. I don't want the scope of it, just the list of items in case/matter entity as a link. Somewhat similar to the way activities is done. Is there a source code I can look at to see how to customize it?
Announcement
Collapse
No announcement yet.
createview list for entity?
Collapse
X
-
PHP Code:Espo.define('advanced:views/quote-item/modals/viewItems','views/modal',function (Dep) {
return Dep.extend({
template: 'advanced:quote-item/modals/viewItems',
scopeList: ['Task','Call','Expense'],
viewRadio: null,
data: function () {
return {
scopeList: this.scopeList,
viewRadio: this.viewRadio
}
},
events: {
'change .view_scope_switch input[name="scope"]': function () {
this.viewRadio = $('.view_scope_switch input[type="radio"]:checked').val();
}
},
setup: function () {
Dep.prototype.setup.call(this);
}
});
});
PHP Code:this.createView('dialog','advanced:views/quote-item/modals/viewItems',{},
function(view){
view.render();
view.notify(false);
this.listenToOnce(view,'select',function(model){
var obj = model.viewRadio;
console.log(obj);
view.close();
},this);
}.bind(this));
Last edited by worldmiros; 03-02-2016, 10:30 PM.
Comment
-
No errors occur before close gets invoked. If I were to write this.close() and/or console.log(this.viewRadio) in the events object (first code), either line of code works. The second code is in directory, 'advanced:views/quote-item/fields/name'. model.viewRadio or model.get('viewRadio') doesn't work. My goal is to render the view of the scopelist, grab the value when user clicks a radio by model.get('viewRadio'), then close.
Comment
-
Such situations require some debug. It's not obvious. There can be some problem. Did you try .remove() instead of close? Or setTimeout(function () { view.close();}.bind(this), 100);
Comment
-
Directory of code below, 'advanced:views/quote-item/modals/viewItems'.
PHP Code:events: {
'click .view_scope_switch input[type="radio"]': function () {
this.viewRadio = $('.view_scope_switch input[type="radio"]:checked').val();
this.close();
this.createView('dialog','Modals.SelectRecords',{
scope:this.viewRadio,
createButton:false
},function(view){
view.render();
view.notify();
this.listenToOnce(view,'select',function(model){
},this);
}.bind(this));
}
}
Comment
Comment