ExtJS: try to be "pure" or mix with HTML?
When creating a new application usin开发者_StackOverflowg ExtJS, is it preferable to use as little HTML as possible, i.e. just the minimal boilerplate HTML file that loads CSS and Javascript files, and do most of the stuff in JavaScript, using ExtJS' layouts, controls etc.; or is it preferable to create normal HTML files with a little bit of ExtJS here and there?
The widget framework is geared towards minimal HTML. Building a rich application using Ext JS is much more like building a desktop application than building a web page. It just happens to be written in JavaScript and runs in a browser.
Start with the boilerplate HTML file, then build your application purely in .js files. Communicate to your web service for data using REST and JSON.
You can do either, although Ext is really more geared toward building UI's in code. You can use Ext Core much as you would jQuery to have a "little bit here and there" but once you get into serious widget/UI development you'll inevitably spend a lot more time in your .js files. Some of the widgets do support instantiation from markup, but not all of them (and it was never built from the ground up to be markup-based like Dojo and maybe some others).
精彩评论