Announcement

Collapse
No announcement yet.

Quick View from detail view

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick View from detail view

    Hi,

    I was trying to call the quick view function, on a button click, from another detail view.

    var viewName = 'views/modals/detail';
    this.createView('quickView',viewName,
    {
    scope: 'Test',
    id: this.model.get("testId"),
    removeDisabled: false,

    }, function (view)
    {
    view.render();
    view.notify(false);

    }, this);

    Which gives an error: Uncaught TypeError: Cannot read property 'name' of undefined

    What change should I do to make it working?

    Thanks in advance.

  • #2
    Hi,

    are you sure the problem is here? Here is everything ok.
    you can remove view.notify(false); if you didn't call notify before and this.model.get("testId") set in some variable, but this part of code looks ok

    Comment


    • krishnapriya
      krishnapriya commented
      Editing a comment
      I wrote this code in quote.record.item file

      I have one button in quote item=> comments


      events: {
      'click .comments': function (e) {
      alert(this.model.get("testId")); // has value
      if(this.model.get("testId")){
      var viewName = 'views/modals/detail';
      this.createView('quickView',viewName,
      {
      scope: 'Test',
      id: this.model.get("testId"),
      removeDisabled: false,

      }, function (view)
      {
      view.render();
      }, this);
      }
      }

      },


      giving error

  • #3
    id: this.model.get("testId"),

    if you set manually the existing id in the code, does it work?
    After test other record. Because I tested your code with account and it works


    And more details for "Cannot read property 'name' of undefined"

    Comment


    • krishnapriya
      krishnapriya commented
      Editing a comment
      Thank you Tanya,

      I tried giving id manually-> didn't work.

      There is no error msg in error log, error only found in browser console.

      Uncaught TypeError: Cannot read property 'name' of undefined
      at n.setup (eval at _execute (espo.min.js?r=1525873562:16), <anonymous>:74:30)
      at n.initialize (espo.min.js?r=1525873562:16)
      at n.e.View (espo.min.js?r=1525873562:6)
      at n [as constructor] (espo.min.js?r=1525873562:6)
      at n [as constructor] (espo.min.js?r=1525873562:6)
      at n [as constructor] (espo.min.js?r=1525873562:6)
      at new n (espo.min.js?r=1525873562:6)
      at Bull.Factory.<anonymous> (espo.min.js?r=1525873562:16)
      at Bull.Factory.<anonymous> (espo.min.js?r=1525873562:16)
      at espo.min.js?r=1525873562:16

  • #4
    leave only console.log. Is it work well?

    events: {
    'click .comments': function (e) {
    console.log('test');
    }
    },

    Comment


    • krishnapriya
      krishnapriya commented
      Editing a comment
      Yes this code works.


      events: {
      'click .comments': function (e) {
      this.getRouter().navigate('#Test/view/' + this.model.get("testId"), {trigger: true});
      }
      },

      This is working fine. But I am trying to display the test page in the same page using quick view
Working...
X