sergiodlopes / jquery-flexdatalist

Flexible input autocomplete/datalist plugin for jQuery
http://projects.sergiodinislopes.pt/flexdatalist/
MIT License
365 stars 84 forks source link

Setting default value from remote url (json) #238

Open tonykalok opened 2 years ago

tonykalok commented 2 years ago

using asp.net mvc5, may I know how to set default value from remote url (json)? Tried using .val(1) or .val("1") but the textbox is showing id "1" but not the name with id 1. Did I miss anything? Thank you

    <input id="CustomerId" name="CustomerId" type="text"
           class="flexdatalist form-control"
           data-min-length="2"
           data-selection-required="true"
           data-allow-duplicate-values="false"
           data-search-contain="true"
           data-max-shown-results=10
           data-search-delay=50
           data-cache="true"
           data-cache-lifetime=1
           data-url=**'/api/customers'**
           data-search-in='["name"]'
           data-visible-properties='["name"]'
           data-value-property='id'
           data-text-property='{name}'>