Wijimo combobox with Angular2. OnChange for User Actions vs code update changes

Posted by: swetha-vemuri on 14 September 2017, 11:41 am EST

    • Post Options:
    • Link

    Posted 14 September 2017, 11:41 am EST

    Hi,

    I am using 2 wijimocombobox components in angular2. In my code I am expecting the user to change a dropdown selection and upon the user change event, the server side code would change the value of the other dropdown. In the event of value change , I am performing some action and logic.

    Is there a way I can differentiate the change event from user interaction vs a change event from server.

    I see that when i use onChange , the control does not even trigger an onchange event on user change of the dropdown.

    I have added an eventListener to listen for ‘onSelectedIndexChanged’ events, but this gets triggered for both user change of a dropdown value, as well as system changing a dropdown value.

    Thanks,

    Swetha

  • Posted 14 September 2017, 11:41 am EST

    Hi,

    Sorry for the late reply. You could provide some value to the EventArgs of this function in the View and check for EventsArgs value inside the onSelectedIndexChanged event. When this event is fired via user interaction then it would have the value that you have specified in the View else it would be null.

    
    
    <wj-combo-box [itemsSource]="countries"
                  [isEditable]="true"
               (selectedIndexChanged)="onSelectedIndexChanged("userinteraction")">
    </wj-combo-box>
     onSelectedIndexChanged(args: any): void {
         if (args == "userinteraction") {
             console.log("user");
         } else {
             console.log("code");
         }
     }

    Thanks,

    Abhishek

  • Posted 20 July 2018, 1:43 pm EST

    I also have same issue. I am also seeing selectedIndexChanged changed fired 3 times

    <wj-combo-box #showGridWjComboBox id="showGridWjComboBox" [itemsSource]="showGridOptions" [displayMemberPath]="'name'" [selectedValuePath]="'id'" [selectedItem]="selectedShowGridOption" style="float:right; margin-right:10px; margin-top:1px;" (selectedIndexChanged)="showGridsOptionsSelectedIndexChanged('useraction')">
        </wj-combo-box>
    
       this.showGridOptions = [];
       this.showGridOptions.push({id: 0, name: 'Both'});
       this.showGridOptions.push({id: 1, name: 'Account Rules'});
       this.showGridOptions.push({id: 2, name: 'Bucket Holdings'});
    
    private showGridsOptionsSelectedIndexChanged(args: any) {
            if (args === "useraction") {            
                console.log(this.selectedShowGridOption);
            } else {
    
            }
        }
    }
    
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels