3

I am trying to use a feature in jquery 1.4.4 (.live on "change" for selects) though if I simply replace it in fogbugz I get various errors in the rest of the code. so the question is: will you guys change your jquery to the latest? or do you know of how i can "push" a javascript state, do my calls to 1.4.4, then restore the javascript state (which would include restoring the 1.3.2 that you guys use)

thanks

flag

3 Answers

5

You should be able to accomplish this using

<script src="path/to/jquery_1.4.4"></script>
<script>
(function(jQuery, $){

   // Your code, using jQuery 1.4.4

})(jQuery, $);

// Let the rest of FogBugz use the 1.3.2 versions of $ and jQuery    
$.noConflict(true);
</script>

From http://api.jquery.com/jQuery.noConflict/:

...we can free up the jQuery name as well by passing true as an argument to [noConflict]... if we need to use multiple versions of the jQuery library on the same page

link|flag
sorry I'm not sure how to paste my code here, but here's a url to it: pastebin.com/VA6w6nVv your tip helped to get the versions to play nicely, but now it's not properly binding the "change" event for the project drop down. if I just stomp jquery to 1.4.4 then the script works fine except other parts of fogbugz breaks. if i use your tip, then the versions play nice but the change event doesn't get run. any ideas? – albert meyburgh Jan 22 2011 at 0:00
PS: I'm using this to serve my javascript from your api: public string[] StaticJSFiles() { return new string[] { "jquery-1.4.4.js", "myscript.js" }; } – albert meyburgh Jan 22 2011 at 0:03
0

Our selects predate JQuery by quite a few years. We haven't yet had the time or engineering resources to make them JQuery-compliant, so you might have some difficulty. If you let us know what you're trying to accomplish, we might have a workaround for you.

link|flag
I'm trying to hide certain ui elements based on which project is selected from the project drop down. I can get it to work for "new" bugs, but when I "view" then "edit" a bug, it doesn't work since the drop down isn't there yet when the page is first loaded. if i force jquery 1.4.4 it works, but then breaks other things which is why im here :) – albert meyburgh Feb 2 2011 at 17:54
0

This won't directly address your question, but here are two things that may help.

First, in regards to hiding a field, see http://fogbugz.stackexchange.com/questions/6877/unable-to-configure-dropdown-person-custom-fields-per-project-category/6884#6884. Dropdowns aren't hideable yet, but they should be soon.

Next, to detect the transition into edit mode, you can add this bit of JS:

$(window).bind("BugViewChange", function() { whatever });

That should make it easier to find fields that aren't present when the page is first rendered, and is exactly how the custom fields plugin accomplishes its work.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.