Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# Constructor 5/23/2009 9:24 PM (edited 5/23/2009 9:26 PM)
When using the RegisterJavascript() via the ModuleAdminBasePage I have stumbled across an issue that I have overlooked. Cuyahoga uses the IDictionary BasePageControl _javascripts (HashTables) to store the KVPs that are to be rendered to the page in question. When using jQuery script registration order is critical.

I am looking at the least painful solution. Any ideas on which way to go?

SortedDictionary?
# Constructor 5/24/2009 12:42 AM (edited 5/24/2009 12:46 AM)
I have made a few changes and tests. The solution is a very simple one but it requires making some changes to the BasePageControl.cs (and maybe elsewhere where this issue is present). Here are the steps.

-----------------------------
1) Add this below the 'using System.Collections' directive.

using System.Collections.Specialized;
-----------------------------
2) Change:

private IDictionary _javascripts;

to

//private IDictionary _javascripts;
private OrderedDictionary _javascripts;
-----------------------------
3) Change:

public BasePageControl()
{
this._stylesheets = new Hashtable();
this._javascripts = new Hashtable();
}

to

public BasePageControl()
{
this._stylesheets = new Hashtable();
//this._javascripts = new Hashtable();
this._javascripts = new OrderedDictionary();
}

-----------------------------

That fixes it. From now on the scripts are rendered in the order they are registered.

I am going to make a few more tests and see if there are any other places that need this change. I do think that this should be added to the build. (Otherwise jQuery usage is a matter of chance!) I found this issue whild building my new TechArticles module that has jQuery UI admin elements. I will post more on this when it is near finished.
# martijnb 5/24/2009 10:57 PM
Good point. This should be improved. I created a Jira issue for it.

Thanks.
# Constructor 5/25/2009 12:11 AM
martijnbGood point. This should be improved. I created a Jira issue for it.

Thanks.

I think there is already be one that I added yesterday. maybe I added it incorrectly or in the wrong place.