Jump to content

DaData в Simple


Rashp
 Share

Recommended Posts

Здравствуйте всем, подскажите пожалуйста кто-нибудь настраивал Dadata в simple? 

поделитесь кодом js пожалуйста для городов, у меня есть такой, не знаю будет работать или нет

var token = "   ";

var defaultFormatResult = $.Suggestions.prototype.formatResult;

function formatResult(value, currentValue, suggestion, options) {
  var newValue = suggestion.data.city;
  suggestion.value = newValue;
  return defaultFormatResult.call(this, newValue, currentValue, suggestion, options);
}

function formatSelected(suggestion) {
  return suggestion.data.city;
}

$("#address").suggestions({
  token: token,
  type: "ADDRESS",
  hint: false,
  bounds: "city",
  constraints: {
    locations: { city_type_full: "город" }
  },
  formatResult: formatResult,
  formatSelected: formatSelected,
  onSelect: function(suggestion) {
    console.log(suggestion);
  }
});

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...