Javascript中的Sharepoint 2013人员选择器更改事件

时间:2016-06-16 19:21:31

标签: javascript jquery sharepoint sharepoint-2013

我希望Javascript中的人员选择器更改事件,因为如果使用ClassName在人员选择器中选择/更改了用户,我必须执行一些任务。

我试过以下

$(".Assignedname").bind('input propertychange', function() { 
     alert("Onchange event" ); 
})

当我输入任何内容(即文本被更改)时会触发,但在人员选择器中选择用户时不会触发。 请给我一些解决方案。感谢

2 个答案:

答案 0 :(得分:1)

初始化人员选择器后,您可以在js字典中访问它并将一个函数分配给选择器的OnValueChangedClientScript属性。该函数接受两个参数,其中第二个参数(userInfo)是选择器中的用户集合

// A nested loop through the IDs:
UNWIND RANGE(1,3) as i1 WITH i1
    UNWIND RANGE(i1+1,3) as i2 WITH i1, i2

// Take a pathways for each pair of IDs:
MATCH p1 = (N1:Node)-[:transition*5 {id:[i1]}]->(N2:Node), 
      p2 = (N1:Node)-[:transition*5 {id:[i2]}]->(N2:Node)

// Take the nodes of each path:
WITH i1, i2, 
     nodes(p1) as p1, 
     nodes(p2) as p2

WITH i1, i2, p1, p2, 
     // Check whether the nodes are different:
     REDUCE(acc = [], x in RANGE(0, size(p1)-1) | 
            acc + [ { i:x, 
                      is: (p1[x] <> p2[x]) AND 
                          (p1[x]['title'] <> p2[x]['title']) 
                    } ]
     ) as isComm

WITH i1, i2, p1, p2,
     // Take only those nodes that are different: 
     FILTER(pair in isComm WHERE pair['is'] = true) as isComm

RETURN i1 as id1, i2 as id2,
       // Convert a map to an array:
       REDUCE(acc = [], pair in isComm | 
              acc + [ [ p1[pair['i']], 
                        p2[pair['i']]
                    ] ] 
       ) as commutative

答案 1 :(得分:0)

您需要获取SharePoint Client People Picker更改事件的选择器ID。使用Cart.aggregate([ { "$match": { "user_id": _user._id } }, { "$unwind": "$services" }, { "$lookup": { "from": TimeSlot.collection.name, "localField": "services.timeSlot_id", "foreignField": "_id", "as": "services.timeSlot_id", }}, { "$lookup": { "from": Service.collection.name, "localField": "services.serviceId", "foreignField": "_id", "as": "services.serviceId", }}, { "$unwind": "$services.timeSlot_id" }, { "$unwind": "$services.serviceId" }, { "$group": { "_id": "$_id", "services": { "$push": "$services" }, "cartId" : { "$first": "$cartId" }, "supplierId" : { "$first": "$supplierId" }, "user_id" : { "$first": "$user_id" }, "createdAt" : { "$first": "$createdAt" } }} ]) 的方法如下。在这里,要获取选择器div,我遵循了通过人员选择器文本框OnUserResolvedClientScriptid进行获取的方法,可以通过检查元素来获取它。将以下代码放入title name函数中。快乐编码

$(document).ready