How To Overwrite getValue Method For Combo Control?

Hi,
I would like to overwrite a getValue method by creating custom combo control, so that i can configure displayField and valueField and on getValue method, i will get the valueField value instead of "id" property value which is default behavior. Please find the snippet @ https://webix.com/snippet/eaf7e19d.
Waiting for the reply.
Thanks,
Ranjith G.

Tagged:

Comments

  • edited September 2017

    Hello,

    For your needs you should not only rewrite the getValue method, but also tune input and list templates, so that they can display the "displayField" correctly. Also, you will need to adjust filtering, so that the list is filtered by the displayed value.

    Check the following snippet, please: https://webix.com/snippet/5b2f662e

  • Hi Helga,
    Can you please help me why the selected item is not getting highlighted in the dropdown in the snippet you have shared "https://webix.com/snippet/5b2f662e" ?

    Regards,
    Ranjith G.

  • Hi,
    I got the solution i need to maintain the valuefield and id value same. By this the highlighting of selected item happens. Please find the snippet https://webix.com/snippet/54132a2a.

    There is another way as well, we have to overwrite getMasterValue method of suggest, and return the value the way id will be.

    Regards,
    Ranjith G.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!