Guest User

Untitled

a guest
Jun 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function() {
  3. $('#repeat_content').hide();
  4. var data = [
  5. <% for user in @users %>
  6. { name: "<%= user.full_name %>", id: "<%= user.id %>", type: "<%= user.type %>" },
  7. <% end %>
  8. <% for team in @teams %>
  9. { name: "<%= team.name %>", id: "<%= team.id %>", type: "Team" },
  10. <% end %>
  11. ];
  12.  
  13. $("#users").autocomplete(data, {
  14. mustMatch: true,
  15. matchContains: true,
  16. formatItem: function(row, i, max) {
  17. return row.name + " [" + row.type + "]"; // <-- ERROR OCCURS HERE
  18. }
  19. },
  20. formatMatch: function(row, i, max) {
  21. return row.name + " " + row.id;
  22. },
  23. formatResult: function(row) {
  24. return row.name;
  25. }
  26. });
  27. });
  28. </script>
Add Comment
Please, Sign In to add comment