Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom new Field . #172

Open
Arjun-Shinojiya opened this issue Sep 30, 2019 · 3 comments
Open

Add custom new Field . #172

Arjun-Shinojiya opened this issue Sep 30, 2019 · 3 comments

Comments

@Arjun-Shinojiya
Copy link

Hello guys, I have list of images which are coming from Api. I want to show that images name in the dropdown . I am using this setting for now.

this.dropdownSettings = {
            singleSelection: false,
            idField: 'item_id',
            textField: 'item_text',
            selectAllText: 'Select All',
            unSelectAllText: 'UnSelect All',
            allowSearchFilter: true
     };

Now issue is , I need one more custome field which is for Imagepath. To add path of image. Currently I am mapping field like below.

this.allImages.push({
                         item_text: res['data'][i]['name'],
                         item_id: res['data'][i]['uuid'],
                         item_path: res['data'][i]['path']
                     });

but when I select event of onSelectItem , the item_path field is not coming. I dont know how to add this field in dropdown setting. Please help me to add custom fields .Thank you

@NileshPatel17
Copy link
Owner

Please share sample code using codesandbox.com or stackblitz.com to help me re-produce the issue.

@Arjun-Shinojiya
Copy link
Author

@NileshPatel17 I just wanted to know if I can add one more field in dropdown setting other than idField and textField.

@NileshPatel17
Copy link
Owner

NileshPatel17 commented Oct 3, 2019

@Arjun-Shinojiya additional field can not be added. However, if the api is returning data, you can bind idField to 'uuid' and textField to 'name, and onSelectItem, you will get all 3 fields.
sample api data:-

[
{ uuid:1,
name:'flower.jpeg',
path:'https://aws.south.com/flower.jpeg'
},
{ uuid:2,
name:'flower2.jpeg',
path:'https://aws.south.com/flowe2r.jpeg'
}
]

let me know if this makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants