Giter Club home page Giter Club logo

Comments (5)

Burgov avatar Burgov commented on August 18, 2024

Hi,

I've created a 2.1 branch which I got working in a SF2.1 project. Let me know if it works for you as well.

See you tomorrow at the meetup!

Regards,
Bart

from autocompletebundle.

kvdnberg avatar kvdnberg commented on August 18, 2024

Hi Bart,

I've upgraded to 2.2, and the bundle seems to be working, but I'm unclear as to how to make this work inside an exisiting form builder. At first I got just an UnexpectedResponseException with no info, when I commented that line out I got constraint violation exceptions which happen because it seems the whole form is being submitted, which makes sense, but then it's not clear to me how I could integrate the autocomplete in an exisiting form with a select2 box.

This is what I have in my form builder:

        $builder
            /* Samson autocomplete bundle doesn't work in this setup, submits whole form. */
              ->add('participant', 'autocomplete',array('label' => _('Deelnemer'),

                    'class' => 'MyBundle:Participant',
                    'search_fields' => array('autocomplete.firstName'),
                    'template' => 'MyBundle:Autocomplete:participant_autocomplete.html.twig',

                ))
          //old participant select 
          //->add('participant',null,array('label'=> _('Deelnemer'), 'empty_value' => 'Nieuwe deelnemer'))
            ->add('registrationDate',null,array('label' => _('Registratie datum'),
                            'format' => 'dd-MM-yyyy HH:mm:ss',
                        'widget' => 'single_text', 
                        ))
            ->add('paid', null, array('label' => _('Betaald')))
            ->add('active', null, array('label' => _('Actief')))        


        ;

from autocompletebundle.

Burgov avatar Burgov commented on August 18, 2024

Hi,

I've updated the tag on the unexpectedresponse bundle, so now when you run composer, you should get a newer version which will actually explain what went wrong.

Basically, you'll need to enable this UnexpectedResponseBundle in your AppKernel. Then, everything should work as expected. I'll add a note on this in the docs.

Hope it helps!

from autocompletebundle.

kvdnberg avatar kvdnberg commented on August 18, 2024

Thanks! It works now, just one issue, it now starts searching as soon as you click in the field. I tried adding
'validation_constraint' => new NotNull()
but it still displays all options as soon as you click the box, which kind of defeats the purpose....
I added
minimumInputLength: 2,
to autocomplete.js to fix this.

One other thing is that I noticed the search is case sensitive (while the default select2 behaviour is not). Would be nice if it could be case insensitive.

from autocompletebundle.

Burgov avatar Burgov commented on August 18, 2024

if i'm not mistaken all searching is done on the server side, so if it turns out to be case sensitive, I guess it should be solved there somehow. We haven't had problems with case sensitivity yet...

a setting for min input length could indeed be desirable. For us the minlength of 0 was chosen deliberately, but might not always be optimal

from autocompletebundle.

Related Issues (13)

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.