[Vtigercrm-developers] How to extend feature such as Global Search without core modifications ?
Preexo
preexo at googlemail.com
Wed Feb 17 07:42:17 GMT 2016
Oh, but If I define it like this, I can see bar when loading the page and foo
when actually searching something... Is this the right way then to overwrite
a function of an existing class?
Vtiger_Header_Js("Vtiger_Header_Js",{},{
basicSearch : function() {
console.debug("bar");
},
});
Vtiger_BasicSearch_Js("Vtiger_BasicSearch_Js",{},{
search : function(value) {
console.debug("foooo");
},
});
Thanks for support and help again! Best regards
Preexo wrote
> I have been struggling with this forever too. I always worked around it by
> ignoring existing and removing elements and hooks via JQuery in my custom
> extension (works, but always seemed really dirty). The overwriting as Alan
> suggested seems much cleaner and straight forward, so I just gave it a
> shot and added a new custom extension to my installation with a Javascript
> file containing:
>
> Vtiger_Header_Js("MySearch_Header_Js",{},{
> basicSearch : function() {
> alert("I need to see this first");
> console.debug("bar");
> },
> });
> (function($) {
> $(document).ready(function(){
> console.debug("foo");
> });
> })(jQuery);
>
>
> The file gets loaded though the HEADERSCRIPT, I even see the "foo" in the
> console, but I don't manage to overwrite the basicSearch function, I never
> see the alert. What am I missing?
>
> How do you properly overwrite a function from another class? I know
> Javascript, but have never done it this way and actually can't really find
> any documentation on this either.
>
> Alan, can you help us out a bit further, what's the key to overwrite the
> basicSearch function in the Vtiger_Header_Js class through a custom
> extension properly?
>
> Thanks and best regards
--
View this message in context: http://vtiger-crm.2324883.n4.nabble.com/How-to-extend-feature-such-as-Global-Search-without-core-modifications-tp18384p18446.html
Sent from the vtigercrm-developers mailing list archive at Nabble.com.
More information about the vtigercrm-developers
mailing list