ShihMingSyu / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

Autocompleter not working in selectBox mode true when an ajax request is made #619

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
(This is for feature requests and bugs in Struts2 jQuery Plugin - for
getting help, please use the User Group.
http://groups.google.com/group/struts2-jquery )

What steps will reproduce the problem?
1. I populate the autocompleter with a list that is a json result from an 
action. This result only returns the values that match with the written text in 
the input. I filter it calling getTerm() in the action side.
2. The autcomplete doesn't make an ajax request, but without selectBox option 
it works good.

What is the expected output? What do you see instead?
I should see the autocompleter loaded according to the

Which struts2 version?
2.2.1.1

Which struts2-jquery plugin version?
3.1.0

Please provide any additional information below.

This is the autocompleter tag not working:
------------------------------------------

<s:url action="listadoAreasDescripcionTerm" id="areasDescripcion" /> 
                            <sj:autocompleter id="tabAvActArea" href="%{areasDescripcion}"  name="buscadorDeActuaciones.busquedaAvanzadaActuacion.actAreaCodigo"
delay="100" list="listadoAreas" listKey="codigo" listValue="descripcion" 
loadMinimumCount="2" size="70" indicator="indicatorArea"/>

This is the declared action:
----------------------------

<action name="listadoAreasDescripcionTerm" 
method="consultarListadoAreasJsonTerm" class="actions.util.AreaAction">
 <result name="success" type="json">
   <param name="includeProperties">
   ^listadoAreas\[\d+\]\,
   ^tabVeListVecinos\[\d+\]\.codigo,
   ^tabVeListVecinos\[\d+\]\.descripcion                          
   </param>
 </result>
</action>

This is the code in the action side:
------------------------------------

public String consultarListadoAreasJson() throws Exception {

        IABM<Area, String> persistArea = GenerarAdmin.getPersistencia(Area.class);
        Area area = new Area();
        area.setHabilitada(true);

        setListadoAreas((List<Area>) persistArea.consultarModel(area, 0, "descripcion"));

        return SUCCESS;
    }

    public String consultarListadoAreasJsonTerm() throws Exception {

        if (getTerm() != null && getTerm().length() > 1) {

            IABM<Area, String> persistArea = GenerarAdmin.getPersistencia(Area.class);
            Area area = new Area();
            area.setHabilitada(true);

            Map<String, Object> parameters = new HashMap<String, Object>();
            parameters.put("descripcion", getTerm());

            setListadoAreas((List<Area>) persistArea.consultarPorParametros(parameters));

        }
        return SUCCESS;
    }

Original issue reported on code.google.com by jmped...@gmail.com on 3 Aug 2011 at 5:15

GoogleCodeExporter commented 9 years ago
Can you please try latest version 3.2.1?

Original comment by johgep on 3 Jan 2012 at 9:20

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 11 Jul 2012 at 10:05