Coder Social home page Coder Social logo

Comments (14)

nobbynobbs avatar nobbynobbs commented on May 29, 2024

Hi! I'm not sure, but probably I work wrong with context in callback functions in my component. I'll think about this issue.

from react-dadata-suggestions.

pavelkuligin avatar pavelkuligin commented on May 29, 2024

I found workaround already :-)
<DadataSuggestions token={ token } placeholder="Иванов Иван Иванович" query={this.state.query} onChange={(query) => this.setState({query: query}) } service="fio" onSelect={ (suggestion) => { this.setState({person: suggestion} ) } } />

from react-dadata-suggestions.

nobbynobbs avatar nobbynobbs commented on May 29, 2024

so can i close the issue?

from react-dadata-suggestions.

pavelkuligin avatar pavelkuligin commented on May 29, 2024

I think yes

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

I thimk this should be reopened.

from react-dadata-suggestions.

nobbynobbs avatar nobbynobbs commented on May 29, 2024

@SDKiller maybe. But could you explain why?

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

from react-dadata-suggestions.

nobbynobbs avatar nobbynobbs commented on May 29, 2024

@SDKiller

You could use query option to initialize query string, see Address example at https://codesandbox.io/s/p95804280q

I think it fits your case.

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

Thanks for example, if I initialize it via query - I got not editable field, I'll try to find what I'm doing wrong.

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

@nobbynobbs
Could you please suggest, how onSelect to send one more query with unrestricted_value and count 1?
The problem is that suggestions are returned with empty geo_lat and geo_lon.

According to today's answer of dadata support:

Подсказки возвращают координаты после того, как человек выбрал конкретный адрес из списка.

В API это запрос с параметром count = 1. При этом текст запроса должен быть результатом одного из предыдущих запросов (значением поля unrestricted_value). Например:

{ "query": "г Москва, ул Сухонская, д 11", "count": 1 }

from react-dadata-suggestions.

nobbynobbs avatar nobbynobbs commented on May 29, 2024

@SDKiller I'm afraid react-dadata-suggestion can't do such query for you. You could make this query manually in onSelect callback with fetch-api or axios.

from react-dadata-suggestions.

SDKiller avatar SDKiller commented on May 29, 2024

from react-dadata-suggestions.

nobbynobbs avatar nobbynobbs commented on May 29, 2024

Not at all

from react-dadata-suggestions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.