add multiple items to quoteitem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • worldmiros
    Senior Member
    • Dec 2015
    • 120

    add multiple items to quoteitem

    In createView, I add a property, multiple: true. When I select multiple items, I get an error, "product.get is not a function" in the console. I ran iteration in listentoonce, this.selectProduct(model[i]);, but then I get error of "cannot set property 'checked' of undefined.
    Last edited by worldmiros; 03-30-2016, 03:29 PM. Reason: error through iteration
  • worldmiros
    Senior Member
    • Dec 2015
    • 120

    #2
    How can I add multiple items from the view rendered? I either get an error, "product.get is not a function", or if I run a loop with the model in the name directory, only the last item on the view rendered is set on the itemlist.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8467

      #3
      Not sure, but I believe it pass array of models into event.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • worldmiros
        Senior Member
        • Dec 2015
        • 120

        #4
        When multiple is set true, then it becomes an array. I ran an iteration:
        PHP Code:
        this.createView('dialog','Modals.SelectRecords',{
        scope:'Task',
        createButton:false,
        primaryFilterName:'completed',
        multiple:true
        },function(view){
        view.render();
        this.notify(false);
        this.listenToOnce(view,'select',function(model){
        model.forEach(function(m){
        this.selectProduct(m);
        },this);
        },this);
        }.bind(this)); 
        
        I don't think that is the problem. I believe the issue, when is multiple is set true, then however many items select, must generate the same amount of divs to set the value to. I know in events, this.addItem() is triggered when user clicks the add button. I have to figure out a way to add divs and set values to the inputs based on the amount of items selected.

        Comment

        Working...