I really love Ext but coding in javascript just gives me the chills. So I went out and found a way to use my favorite js library (Ext) and my favorite programming language (C#) at the same time. By using a project called Script# I am able to write C# code and have it converted into javascript, similar to GWT. Building on that, Script# also allows you to code against external APIs, but you need to create the types, methods, properties, etc. for everything in the javascript library. So what I did was write a little console app that parses all of the ExtJS source files extracting out the script comments and writing C# files for each class. The end result is a programmable C# API to access all of the Ext objects and I threw in a couple new things to make life a little easier.

Since the entire API is generated, I haven't been able to check every piece of code to make sure nothing is missing, but from what I can tell all of it should be there. The only thing that doesn't work and I have to spend some time to figure out is the methods on Function objects such as createDelegate, defer, etc. Script# includes a createDelegate method but not a defer method. Another feature I want to get done is to create types for each classes constructor config objects so you can get intellisense on the config parameter.

Here is a demo page I put online, this was written entirely in c# code.
It's just the Products in the Northwind DB (Note: This app still uses Ext 1.1.1, I'll update it one day)
http://ext.ordereze.net/scriptsharp/products.aspx

Here's a link to download the complete demo project
http://extsharp.googlecode.com
- The only requirement to run this project locally is to download and install Script# from here and VS2005 of course

And here's the source code for the javascript parser that creates the Ext API
http://extsharp.googlecode.com

UPDATE - 9/14/07
A few things to be aware of when working with this api
  • Since C#/Script# does not allow for classes to be named the same as namespaces, I had to rename a few classes. They are Ext, Toolbar, DomHelper, UpdateManager, SplitBar. These classes have been renamed to {name}Class where {name} is the name of the original class (i.e. Ext becomes ExtClass in Script#).
  • In addition to that, the first thing you need to do before you use any Ext code is run the statement below. This method just tells the browser that the class Ext.ExtClass points to the Ext class
    Code:
    ScriptSharpAdapter.init();
  • I kept running into a problem where Script# wouldn't compile the code and the reason always was that I was accessing classes using the fully qualified name. (i.e. new Ext.form.TextField()) all you need to do to fix this is to add a using statement for the namespace (using Ext.form and then changed the code to be (new TextField())
UPDATE - 9/16/07
I've put all source code and downloads on the GoogleCode project website
http://extsharp.googlecode.com
I'll be making updates to the svn repository over there
The change log can be viewed there as well
http://extsharp.googlecode.com/svn/trunk/CHANGELOG.txt

UPDATE - 10/3/07
This API has been converted to work with the ExtJS 2.0 alpha release. I want to create some samples using it before packaging it up for a release though. Expect an update within the next few days.

UPDATE - 12/5/07
Updated ExtSharp to parse ExtJS v2.0 Final. Zipped up the parser and the samples.