Jquey AutoComplete填充共享点列表项 [英] Jquey AutoComplete to populate sharepoint list items

查看:61
本文介绍了Jquey AutoComplete填充共享点列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否请您帮助我确定以下自动填充的简单代码出了什么问题?它没有填充.

Could you please help me identifying what is wrong with the below simple code to auto populate? Its not populating.

我有一个名为城市"的列表,约有100条记录.我可以按标题网址浏览api.当我输入2个字母时,它应该会填充并建议城市以2个或更多字母开头.

I have a list called "City" with around 100 records. I can browse the api get by title url. When I type 2 letters, it should populate and suggest cities begins with 2 or more letters.

< html>
< head>
< link rel ="stylesheet" href =" http://code.jquery.com/ui/1.10 .3/themes/smoothness/jquery-ui.css;"/>
< script type ="文本/javascript" src =" </script" https://code.jquery.com/jquery-1.11 .0.min.js"></script >
< script type ="文本/javascript" src =" </script" http://code.jquery.com/ui /1.11.2/jquery-ui.js"></script >

<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css;"/>
<script type="text/javascript" src="</script">https://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="</script">http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

< script>
$(document).ready(function(){
  $(#autobox").autocomplete({
   minLength:2,
 来源:功能(请求,响应){
  var term = request.term.capitalizeFirstLetter();
  var restUrl = _spPageContextInfo.siteAbsoluteUrl +"/_ api/Web/Lists/getbytitle('City')/items?$ select = Title& $ filter = substringof('" + term +"',Title)"

<script>
$(document).ready(function () {
  $("#autobox").autocomplete({
   minLength: 2,
  source: function (request, response) {
  var term = request.term.capitalizeFirstLetter();
  var restUrl = _spPageContextInfo.siteAbsoluteUrl + "/_api/Web/Lists/getbytitle('City')/items?$select=Title&$filter=substringof('" + term + "',Title)";

   $ .ajax({
      contentType:"application/json; odata = verbose",
标头:{"accept" :"application/json; odata = verbose"; },
   url:restUrl,
   dataType:"json",
  成功:函数(数据){         
   response($.map(data.d.results,function(value,key){
  返回{
    标签:值.标题,
  值:值.标题
        };
 }));    
   }
  });
 }

   $.ajax({
      contentType : "application/json;odata=verbose",
 headers : { "accept" : "application/json;odata=verbose" },
  url: restUrl,
  dataType: 'json',
  success: function(data){          
  response($.map(data.d.results, function (value, key) {
  return {
    label: value.Title,
   value: value.Title
         };
 }));    
   }
  });
 }

});
                                      
});

});
            
});

</script>

</script>

</head>
< body>
jQuery测试
<输入类型=文本"; id ="autobox" />
</body>
</html>

</head>
<body>
jQuery Test
<input type="text" id="autobox" />
</body>
</html>

非常感谢

Shri

推荐答案

嗨SHri

请检查下面的linbk

Please check the linbk below

https://stackoverflow.com/questions/5224349/using-autocomplete-to-filter-a-list-in-a-jquery-list-in-sharepoint?rq=1

https://stackoverflow.com/questions/5224349/using-autocomplete-to-filter-a-list-in-a-jquery-list-in-sharepoint?rq=1


这篇关于Jquey AutoComplete填充共享点列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆