jqgrid autocomplete on dynamic local source -
im trying work form editing autocomplete .. source different every time user opens edit form
when opening edit form :
beforeshowform: function(frm) { var id = grid.jqgrid('getgridparam','selrow'); if (id) { var ret = grid.jqgrid('getrowdata',id); acccode = ret.szacccode; }; $.post("url_getchildren", { szacccode: acccode}). done(function(data) { lschildcode=data; }); },
i have managed result server, cant send grid.
colmodel
:
{name:'szaccparentcode',index:'szaccparentcode', editable:true, edittype:'text', editoptions : { datainit: function(elem){ $(elem).focus(function(){ this.select(); }), $(elem).autocomplete({ source:lschildcode }) } } },
why cant pass lschildcode
autocomplete's source? , autocomplete kept sending term server every time type in box.
tia
i think datainit
(and autocomplete
) called before done
of $.post
executed.
to fix problem can example call $("#szaccparentcode").autocomplete({source:lschildcode})
inside of done
.
another way: 1 can use url value of source
. url can contains additional parameters. if need use http post can declare source
function , call response
parameter (callback function) inside of success
or done
of source
implementation. @ implementation of source
in the remote caching example , examine code (click on "view source") or examine source code of jquery ui autocomplete near $.ajax
usage (see here).
Comments
Post a Comment