![]() |
#1 |
Участник
|
Dynamics CRM Tools: CRM 4.0: Overriding lookup onclick
Источник: http://mscrmtools.blogspot.com/2010/...p-onclick.html
============== For one of my customer, I faced a difficulty. I wanted to override the lookup onclick event to provide my own lookup selection that uses a treeview (see below picture) which is much mor euser friendly when we talk about self related entities. ![]() ![]() The problem : the behavior of the lookup is controled by a .htc file. It is a bad idea to change this kind of file (unsupported) and you can’t just remove the link to this file in the css class because you will loose all behaviors, not just onclick one. The only way I found was to create a new lookup image with its own behavior, hide the original one, and add the new image next to the original one. All this using javascript. It is also unsupported but you are sure that your javascript won’t be override during rollup installation or other kind of CRM updates. Here is the javascript: <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"> 1: var lookupAttribute = "new_categoryid"; 2: 3: crmForm.performNewClick = function () 4: { 5: // Put here your alternative onclick code 6: } 7: 8: // Build lookup replacement image 9: var replacementImage = <span style="color: #006080">"
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|