1

First of all, I introduce a text in the city input, city input is autocomplete(Jquery UI), and then I select a locality and press enter. Afterwards I add new field to search. When I press new field, jqgrid clears city field.

UI image

This is a part of my code.

{
        name:'City',
        index:'City',
        width:220, 
        align:"center",
        sortable:true,
        editable:true, 
        edittype:'select',
        editoptions:{
            value:load_City
        },
        stype:'text',
        searchoptions:{
            dataInit:function(el){
                $(el).autocomplete({
                                    selectFirst:true,
                                    source: "Codigo/Datos/localidades.php?autocomplete=verdadero"  
                                    })
             },
        sopt:['eq','ne','lt','le','gt','ge']
        }
    }
Alvaro
  • 13
  • 3

1 Answers1

1

If I understand your problem correctly you should add should trigger change event after new value in autocomplete will be selected:

$(el).autocomplete({
    selectFirst: true,
    source: "Codigo/Datos/localidades.php?autocomplete=verdadero",
    select: function (event) {
        $(el).trigger('change');
    }
});
Oleg
  • 219,533
  • 32
  • 395
  • 775
  • Thanks so much. Your post has been very useful – Alvaro Oct 22 '12 at 12:24
  • @Alvaro: You are welcome! If you use toolbar searching too I recommend you to take a look in [very close answer](http://stackoverflow.com/a/13009927/315935) which I answered today. You can ["accept"](http://meta.stackexchange.com/a/5235/147495) the answer if the problem is solved now. You can vote any helpful answer later after you'll get 15 point of reputation. You will get right to vote up about 30 question or answers **per day** with some small limitations (see [here](http://meta.stackexchange.com/a/5213/147495)). It's more as enough in my experience. – Oleg Oct 22 '12 at 12:36