Saturday, 20 February 2016

Hide link in ECB Menu

function HideFeatureActivatedECBMenuItem() {
    if (!CanExecuteHideForECBMenuItem()) return;

    /* find the ECB menu items which are added via feature activation */
    var ecbId = "ECBItems";
    var listName;
    if ((null != ctx.listName) && (0 < ctx.listName.length)) {
        listName = ctx.listName.toLowerCase();
        ecbId = ecbId + "_" + listName;
    }
    var elemTBody = document.getElementById(ecbId);
    if (elemTBody != null) {
        // iterate each table row to find the ECB menu item to remove (hide)
        for (var iMenuItem = 0; iMenuItem < elemTBody.childNodes.length; iMenuItem++)
 {
            var elemTr = elemTBody.childNodes[iMenuItem];
            var elemTdTitle = elemTr.childNodes[0];
            var title = GetInnerText(elemTdTitle);

            // check the ECB item title
            if (title === "Edit Item")
 {
                elemTBody.removeChild(elemTr);
 }
        }
    }
}

No comments:

Post a Comment