员工自动填充不在jquery中工作

时间:2014-01-10 10:08:37

标签: javascript jquery autocomplete

这里写了一些用于自动完成的jquery自动填充代码:

$("#emp").autocomplete({

        source: function( request, response ) {

            $.ajax({
                url: "empauto.do?method=getAutoEmpdetails",
                dataType: "json",
                data: {
                    featureClass:"P",
                    style: "full",
                    maxRows: 96,
                    name_startsWith:request.term
                },
                success: function( data ) {

                    response( $.map( data.list1, function( item ){

                        return {
                            label: item.empname,
                            value: item.empname,

                            id : item.email
                            +"("
                            +item.phone
                            +"("
                            +item.shift_id
                            +"("
                            +item.deptname
                            +"("
                            +item.emplocation
                            +"("
                            +item.empid
                            +"("
                            +item.employeetype
                            +"("
                            +item.empaddress
                            +"("
                            +item.empdesignation
                            }
                    }));
                }

            });
        },
        minLength: 1,
        select: function(event, ui ) {

            var vals = ui.item.id.split("(");


                 $("#name").val(ui.item.label);
                 $("#email").val(vals[0]);
                    $("#phone").val(vals[1]);           
                    $("#shiftid").val(vals[2]);
                    $("#dept").val(vals[3]);
                    $("#location").val(vals[4]);
                    $("#empid1").val(vals[5]);
                    $("#emptype").val(vals[6]);
                    $("#address").val(vals[7]);
                    $("#designation").val(vals[8]);




    /*log( ui.item ?
        "Selected: " + ui.item.id :
        "Nothing selected, input was " + this.value);*/
},

open: function() {
    $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
    $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
    });

它的工作正常但是在选择之后我修改员工信息除了名称和id这个更新操作也运行良好。但是问题是在修改员工后再做自动完成时,比如给开始字符r下拉搜索框中显示的相应员工姓名。

Here problem is previouly modified employees are not coming in searchbox.

但我的查询工作正常,我已经手动检查过。

所以请提供答案jauery中所需的更改,如js文件

0 个答案:

没有答案