Sharepoint JSLink 修改列表项SPListItem的菜单Callouts

前面我们介绍了修改列表样式,今天我们修改列表项SPListItem的菜单,sharepoint里面叫Callouts,效果如下:

 

 

点击相应菜单弹出相应功能:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function Custom_AddListMenuItems(m, ctx) {
    var imgDelete = '';
    CAMOpt(m, "添加机床数", "AddTime(ctx);", imgDelete);
    CAMOpt(m, "添加账号", "AddUser(ctx);", imgDelete);
    CAMSep(m);
    return true;
}
function AddTime(ctx) {
    var restUri = "/supplier/_api/web/lists/SupplierList/items(" + currentItemID + ")/";
    $.ajax({
        type: 'GET',
        url: restUri,
        dataType: 'json',
        headers: {
            "ACCEPT": "application/json;odata=verbose"
        },
        success: function (data) {
            var strOP = "/supplier/SupplierAdmin/AddTime.aspx?id=" + data.d.Id + "&show=1";
            showSPDialog(strOP, data.d.Title);

        }
    });
}
function AddUser(ctx) {
    var restUri = "/supplier/_api/web/lists/SupplierList/items(" + currentItemID + ")/";
    $.ajax({
        type: 'GET',
        url: restUri,
        dataType: 'json',
        headers: {
            "ACCEPT": "application/json;odata=verbose"
        },
        success: function (data) {
            var strOP = "/supplier/SupplierAdmin/AddUser.aspx?id=" + data.d.Id + "&show=1";
            showSPDialogWH(strOP, data.d.Title, 870, 300);
        }
    });
}

分享

文章导航