samsonit / autocompletebundle Goto Github PK
View Code? Open in Web Editor NEWAutocomplete based on Doctrine ORM and Select2
License: MIT License
Autocomplete based on Doctrine ORM and Select2
License: MIT License
The LIKE function in PostgreSQL is unfortunately case sensitive, while other SQL systems are case insensitive with LIKE.
To get consistent behavior I would suggest the following change:
Query\ResultsFetcher.php, line 66
$expressions[] = $qb->expr()->like('LOWER(' . $field . ')', ':query' . $key . $key2);
$qb->setParameter('query' . $key . $key2, '%' . strtolower($searchWord) . '%');
Hi Bart,
I just tried out your autocomplete bundle in Symfony 2.1.8, unfortunately after getting everything set up right I got a fatal error because
Fatal error: Class 'Symfony\Component\PropertyAccess\PropertyAccess' not found in /xxx/vendor/samson/autocomplete-bundle/Samson/Bundle/AutocompleteBundle/Form/Listener/AutoCompleteTypeListener.php on line 68
I looked it up and it seems that the PropertyAccess component is new for Symfony 2.2:
http://symfony.com/blog/new-in-symfony-2-2-new-propertyaccess-component
I'll try upgrading to Symfony 2.2 some time in the next few weeks, but the requirements for this Bundle aren't correct at the moment.
See you at the meetup!
When I search сyrillic text this autocompleter don't work.
For fix this bug change code in line 29 (autocomplete.js) to this code
data = data + "&__autocomplete_search=" + encodeURI(options.term);
Hi Bart,
I have one more small issue that I can't seem to figure out.
The form I'm using the autocomplete in is a modal that is used to add participants for a few different entities on the page. In order to get the right form values I refresh the form through an ajax call. I'm using the query builder to filter out the existing participants so one participant can't be added twice.
If I add this to the form type:
->add('participant',null,array(
'label'=> _('Deelnemer'),
'empty_value' => 'Nieuwe deelnemer',
'query_builder' => function(ParticipantRepository $pr) use($courseBlock) {
return $pr->getParticipantsNotInCourseBlock($courseBlock);
}
It works fine, for each entity the correct items are filtered out.
However, when I try the same with the autocomplete:
->add('participant', 'autocomplete',array('label' => _('Deelnemer'),
'class' => 'MyBundle:Participant',
'search_fields' => array('p.firstName', 'p.lastName'),
'template' => 'MyBundle:Autocomplete:participant_autocomplete.html.twig',
'query_builder' => function(ParticipantRepository $pr) use($courseBlock) {
return $pr->getParticipantsNotInCourseBlock($courseBlock);
}
it filters out the participants of the default entity only, not the selected entity with which the form is rendered through ajax.
I'm guessing this might be some type of caching issue but I can't seem to figure out how to solve it. Could you point me in the right direction?
I have the symfony 2.1, then i tried with 2.1@dev version of the bundle, but I don´t find an example of this bundle on google and i don´t understand how the one on the showcase works, i tried a lot but i can´t get it running. I know this isnt the best place to ask, but i don
t find nothing out there.
Thanks
also update composer.json for this
Select2 Javascripts, Css
JQuery Javascripts
our own autocomplete.js
It should have its own service
instead of relying on the user to add it to the config.yml
since the LabelBuilder doesn't know what was actually searched, search_words are the search-fields, the search_words are only in the request.
How can JavaScript know what to prepend?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.