<input id="cc" name="nickName" class="easyui-combobox" style="width:200px">
var find = function (param, success, error) {
        var q = param.q || "";
        if (q.length <= 0) {
            console.log("q.length <= 0");
            return false;
        }
        $.post("getNickName",{"nickName": q},function (data) {
            debugger
            var items = $.map(data, function(result,index){
                return {
                    value:index,
                    text:result
                }; //遍历数组中的值
            });
            /* var items = $.each(data, function(index,value){//第一个是下标,第二个是值
                return {
                    value:index,
                    text:value
                }; //遍历数组中的值
            }); */
            success(items);//调用loader的success方法,将items添加到下拉框中
        });
    }
    $('#cc').combobox({
        url : 'getNickName',
        valueField : 'value',
        textField : 'text',
        loader : find,
        mode : 'remote'
    });

上面代码中find方法是combobox的loader调用的方法

相关文章:

  • 2021-12-20
  • 2022-02-09
  • 2021-08-09
  • 2021-08-20
  • 2021-10-29
  • 2021-08-09
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-07-11
相关资源
相似解决方案