Override standard method called by double click event in CRM grid.

主宰稳场 提交于 2019-11-29 15:06:54
Peter Majeed

Events in the interface are handled the same way IE handles all events (see the SO question Should i assign JavaScript events directly just to unify code? for just one example).

A functionality for overriding the default doubleclick action might start as follows:

function Load() {
    var grid = document.getElementById("myGridName");
    grid.ondblclick = DoubleClickAction;
}

function DoubleClickAction() {
    var id, url;
    //get the id of the entity in the row you double clicked
    id = GetId();

    //generate the entity form url
    url = GetUrl();

    //open the record window
    OpenRecordWindow(url);
}

function OpenRecordWindow(url) {
    var url;

    if (Xrm.Page.context.isOutlookClient()) {
        openStdWin(url, "Your Title", "width=1024,height=768,status=1");
    }
    else {
        window.open(url);
    }

}

Edit: Based on your comments, you're getting into some pretty serious customization of the DOM here. You'd have to change the dblclick event for each row in the grid whenever the grid refreshes since the right click event is based on the row's dblclick event. So you'd have to find the grid and also attach a refresh event to the grid that attaches a dblclick event to any found rows.

To get the id of the grid, and the potential ids of any rows, you can use IE's F12 developer tools to browse/search through the HTML.

Can you display this data by joining A to B and A to C? How are these three entities related? A to B and A to C? A to B to C?

I ask because you should be able to achieve your goal with the standard join functionality provided by Views and avoid this override business altogether. If you have to setup some relationships between the entities just for this view it is probably preferred to a wrapper entity.

(I would prefer to add this as a comment... I dont think I have enough reputation)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!