Announcement

Collapse
No announcement yet.

createview list for entity?

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

  • createview list for entity?

    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?

  • #2
    I can suggest to search in file contents by keywords 'activities', 'activity'. Ir's a side panel. Side panels are views. Side panels are defined in clientDefs.

    Comment


    • worldmiros
      worldmiros commented
      Editing a comment
      i know where the activities js file is located, as well it's tpl file. I wanted to know is there another file i can look at.

  • #3
    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'],

            
    viewRadionull,


            
    data: function () {
                return {
                    
    scopeListthis.scopeList,
                    
    viewRadiothis.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)); 
    I'm trying another method. The second is in another file. I'm unable to get the 'obj', and once user clicks, I want it to close, but 'view.close()' doesn't work. Am I missing something?
    Last edited by worldmiros; 03-02-2016, 10:30 PM.

    Comment


    • #4
      Not sure. Such situations happen. No errors occurs before close gets invoked?

      Comment


      • worldmiros
        worldmiros commented
        Editing a comment
        Any hint how to capture the value of the radio when user click from another directory ('advance:views/quote-item/fields/name')? I would very much appreciate it.

    • #5
      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


      • #6
        Any help here? I want to the get the value of the radio the user click and close the window, but i'm not getting it.

        Comment


        • #7
          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


          • worldmiros
            worldmiros commented
            Editing a comment
            If I wrote this.close() in the event method it works. My main focus is retrieving the value of the radio selected from another module. If I can do that, then one of my task is completed.

        • #8
          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));
                      }
                  } 
          Another idea was the code above, but is there a way to get selectProduct(product) from 'advanced:views/quote-item/fields/name'?

          Comment


          • #9
            Maybe if I use Dep.prototype.selectProduct.call(this) would allow me access to the method located in directory, 'advanced:views/quote-item/fields/name'? If so, after the call, I can use this.selectProduct(model) to add a new item to quoteItems?

            Comment


            • #10
              Issue resolved. Was able to capture the radio selected and close the window.

              Comment

              Working...
              X