Thursday, March 27, 2008

ext-all.js or ext-all-debug.js

To ease the debugging process, the Ext JS package includes the uncompressed javascript files of their library as well.

Here's a small Rails helper to add the Ext JS library files based on your Rails environment:

# app/helpers/application_helper.rb
module ApplicationHelper

... # your other helpers here

def javascript_include_extjs
if RAILS_ENV == "production"
javascript_include_tag "ext/adapter/ext/ext-base.js", "ext/ext-all.js"
else
javascript_include_tag "ext/source/core/Ext.js", "ext/source/adapter/ext-base.js", "ext/ext-all-debug.js"
end
end

end



In your view layout header you just need to call:


<%= javascript_include_extjs %>


Important: Don't forget the ext js css files!

P.S.
You can find some more hints on debugging Ext JS here.

1 comments:

Unknown said...

I was looking this for so long, thank you, I will translate and divulge it in my blog, thanks again