angularpicklist

what are angular with p-picklist specified actions?


I have this angular code that shows 2 lists and moves items between them. I need to call a method when an item has been moved from the available list to the selected list I tried using (click)="refresh();" but it runs the method on any click and I need to run it specifically when moving item from left to right

<p-pickList (click)="refresh();" [source]="available" [target]="selected" sourceHeader="Available" targetHeader="Selected" [responsive]="true" filterBy="type" 
        dragdrop="true" dragdropScope="items" sourceFilterPlaceholder="Search by name" targetFilterPlaceholder="Search by name" [sourceStyle]="{'height':'300px'}" [targetStyle]="{'height':'300px'}">

    <ng-template let-items pTemplate="item">
        <div class="ui-helper-clearfix">
            <div style="font-size:14px;margin:15px 5px 0 0">{{item.type}}</div>
        </div>
    </ng-template>
</p-pickList>

Solution

  • You need to call onMoveToTarget method, and onMoveToSource method for vice versa, instead of calling (click) event.

    Read more from the documentation