Dynamics CRM JS 隐藏子网格“+”号(不推荐,随笔记录)
调用示例代码:
hideAddButton(window, "tab_approval_process,nextcustomer,billTo,account_attachment");
function hideAddButton(w, subgrids) { ///隐藏子网格加号按钮 /// window对象 /// 子网格名称,多个英文逗号隔开 var subgrid = subgrids.split(','); for (var i = 0; i < subgrid.length; i++) { var _id = subgrid[i] + "_contextualButtonsContainer"; var _button = w.document.getElementById(_id); if ((_button == null || _button == undefined) && window.parent != null && window.parent != undefined) { _button = w.parent.window.document.getElementById(_id); } if (_button != undefined && _button != null) { _button.style.display = "none"; } } }
function hideAddButton(w, subgrids) { ///
var subgrid = subgrids.split(','); for (var i = 0; i < subgrid.length; i++) { var _id = subgrid[i] + "_contextualButtonsContainer"; console.log("ID=" + subgrid[i] + ",i=" + i); var _button = w.document.getElementById(_id);
if ((_button == null || _button == undefined) && window.parent != null && window.parent != undefined) { _button = w.parent.window.document.getElementById(_id); } if (_button != undefined && _button != null) { _button.style.display = "none"; console.log("ID=" + _id + ",Display=" + _button.style.display); } }
}