function pnumberAuto(e) {
$(e).autocomplete({
source: '/Autocomplete/QuickSearchPN',
delay:0,
select: function (event, ui) {
this.value = ui.item.value;
$(this).trigger('change');
return false;
}
})
}
jquery ui autocomplete can not pass whole word to server in IE browser
-
01-09-2022 - |
Pregunta
I'm use :
- jqGrid 4.4.3
- jQuery v1.8.2
- jQuery UI v1.8.24
I use jquery UI Autocomplete,when I put "P" in multiple search textbox,then autocomplete can show "P01","P02",
I select "P02" or other,in firefox that is ok,But in IE8 I get the filters is:
{"groupOp":"AND","rules":[{"field":"PNumber","op":"eq","data":""}]}
data is nothing!
In firefox is:
filters {"groupOp":"AND","rules":[{"field":"PNumber","op":"eq","data":"P02 "}]}
Why this different between IE and Firefox ?
My jqGrid colModel is:
colModel: [
{
name: 'PNumber', width: 30, index: 'PNumber',
searchoptions: {dataInit:pnumberAuto, sopt: ['eq', 'cn'] }
}
]
My autocomplete code is:
function pnumberAuto(e) {
$(e).autocomplete({
source: '/Autocomplete/QuickSearchPN',
delay: 0,
focus: function (event, ui) {
$(e).val(ui.item.label);
},
select: function (event, ui) {
$(e).val(ui.item.label);
}
})
}
And controller is(I use ASP.NET MVC 4):
public ActionResult QuickSearchPN(string term)
{
var q = (from p in db.BOM
where p.PNumber.Contains(term)
select p.PNumber).Distinct().Take(10);
return Json(q, JsonRequestBehavior.AllowGet);
}
Thanks for your help !
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow