jQWidgets Forums

jQuery UI Widgets Forums Angular jqxInput value

This topic contains 1 reply, has 1 voice, and was last updated by  luis 6 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • jqxInput value #104927

    luis
    Participant

    Hi,
    As a source for my jqxInput I have {id: number, name: string}. What I want to achieve is that when something is selected from autocomplete, I want to access this whole object, having ‘name’ as display, and ‘id’ as the value. I’m trying to set [valueMember] and [displayMember] as ‘id’ and ‘name’ correspondingly, but I’m only getting label: name and value: name again. Any suggestion on how to overcome this? Thank you

    const source = {
                datatype: 'json',
                datafields: [
                  {id: 'id'},
                  {name: 'name'}
                ],
                localdata: data
              };
    
              this.dataAdapter = new jqx.dataAdapter(source);
    <jqxInput [source]="dataAdapter" [placeHolder]="'Search patients'"
              [valueMember]="'id'" [displayMember]="'name'" (onSelect)="onSelect($event)">
    </jqxInput>
    
    jqxInput value #104931

    luis
    Participant

    Problem was {id: 'id'}. Changed it to {name: 'id' and it’s working as expected. You can close the topic

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.