Passing model to 'modal/edit' view ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tothewine
    Active Community Member
    • Jan 2018
    • 373

    Passing model to 'modal/edit' view ?

    I have already the model for an entity that I am about to show the edit modal for, but when I pass the model, id and scope in the options it would still make a new api request for the entity data, causing a noticeable delay in render time since mouse click.

    How do I correctly pass the model to the modal edit view? Is there a way to cache or cancel the sync, like a 'before:sync' event and return the existing model?

    PHP Code:
    
    var id='123'; var scope='Lead'; var viewName = 'views/modals/edit';
    var model = {/* model is already got from server */};
    
    this.createView('quickEdit', viewName, {id: id, scope:scope, model: model, mode: 'edit', fullFormDisabled: true}, function (view) {  
     // api has been called twice...
    } 
    
    Last edited by tothewine; 02-01-2019, 11:25 AM.
Working...