SharePoint Nintex Forms - jquery自动完成 - 过滤空值 [英] SharePoint Nintex Forms - jquery autocomplete - filter empty values
问题描述
大家好,
我在Nintex Forms中有一个工作jquery Lookup。
很快在查找列表中有一个空元素我得到错误。
如何只过滤至少包含一个字符的元素?
I have a working jquery Lookup in Nintex Forms.
As soon there is an empty Element in the lookup list I get an error.
How can I filter only for element with at least one character?
我的工作代码:
NWF $ (文件).ready(function(){
//自动填充的源数据是数据处理注册合并列表
//将值存储在数组变量中$
// start字段
var var_System = [];
NWF $()。SPServices({ ;
operation:" GetListItems",
async:false,
listName:"数据处理注册" ister Consolidation",
CAMLViewFields:"< ViewFields>< FieldRef Name ='System'/>< / ViewFields>", //名称不带"/"和空间 /或字段ID - 名称需要相应更改
completefunc:function(xData,Status){
NWF $(xData.responseXML).SPFilterNode(" z:row")。each(function(){
var_System.push(NWF $(this).attr(" ows_System")) // ows_CaseSensitive!(%5F是下划线)
});
}&NBSP;&NBSP;
});
&NBSP; $独特(var_System);&NBSP;&NBSP; //这是消除数组中所有重复项的神奇之处
//输入添加到NF中的控件上
NWF $("#"+系统).autocomplete({
source:var_System
// end field
});
});
My working code:
NWF$(document).ready(function() {
//The source data for the autocomplete is the Data Processing Register Consolidation list
//Store the values in a array variable
//start Field
var var_System = [];
NWF$().SPServices({
operation: "GetListItems",
async: false,
listName: "Data Processing Register Consolidation",
CAMLViewFields: "<ViewFields><FieldRef Name='System' /></ViewFields>", //name without "/" and spaces / or Field ID - the name needs to be changed accordingly
completefunc: function (xData, Status) {
NWF$(xData.responseXML).SPFilterNode("z:row").each(function() {
var_System.push(NWF$(this).attr("ows_System")) //ows_CaseSensitive! (%5F is underscore)
});
}
});
$.unique(var_System); // this is the magic to elimintate all duplicates in array
//input is added on the control in the NF
NWF$("#" + System).autocomplete({
source: var_System
//end field
});
});
推荐答案
如果您想使用SPService实现自动完成功能,请参考以下代码:
If you want to use SPService to achieve autocomplete feature, the following code for your reference:
<script language="javascript" src="//code.jquery.com/jquery-1.6.2.min.js" type="text/javascript"></script>
<script language="javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/2014.02/jquery.SPServices-2014.02.min.js" type="text/javascript"></script>
<script type="text/javascript">
(document).ready(function(){
(document).ready(function () {
( ).SPServices.SPAutocomplete({
sourceList:" Data Processing Register Consolidation",
sourceColumn:" System",
columnName:" System",
ignoreCase:true ,
numChars:2,
slideDownSpeed:'fast'
});
});
< / script>
().SPServices.SPAutocomplete({ sourceList: "Data Processing Register Consolidation", sourceColumn: "System", columnName: "System", ignoreCase: true, numChars: 2, slideDownSpeed: 'fast' }); }); </script>
更多信息:
http://www.itidea.nl/index.php/jquery-spservices-and-autocomplete/
最诚挚的问候,
丹尼斯
这篇关于SharePoint Nintex Forms - jquery自动完成 - 过滤空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!