开发者

TextFieldView does not seem to have been loaded

开发者 https://www.devze.com 2023-03-10 15:30 出处:网络
I am trying to get any results from SC.TextFieldView, but alas, it returns undefined al开发者_如何学Gol the time. All the other view classes seem to be working.If you start a new sproutcore template p

I am trying to get any results from SC.TextFieldView, but alas, it returns undefined al开发者_如何学Gol the time. All the other view classes seem to be working.


If you start a new sproutcore template project, then per default only the core_foundation classes are loaded. That means only those are defined as dependency in your main sproutcore buildfile:

config :all, :required => "sproutcore/core_foundation", :theme => "sproutcore/empty_theme"

In most cases the makes total sense, since the template view system, introduced with sproutcore 1.5 does not work well in combination with templates. Although, it is possible to use the template view within a "traditional" sproutcore view e.g. SC.ContainerView (see http://guides.sproutcore.com/using_handlebars.html#using-sc-templateview-inside-desktop-controls for details) you can't use traditional sc desktop views inside of template views.

Hence, the desktop views are not included in the buildfile when you are starting a new template project. However, some other useful sproutcore modules are also not included per default, e.g. the ajax module, the datastore or the statechart module. If you want to use those modules you have to adjust your buildfile and include those modules. It might look like that

config :all, 
    :required => [ 
        "sproutcore/core_foundation",
        "sproutcore/datastore",
        "sproutcore/statechart",
        "sproutcore/ajax" ]
    :theme => "sproutcore/empty_theme"

to include specific modules or just

config :all, :required => "sproutcore", theme => "sproutcore/empty_theme"

to include all available sproutcore modules. If you want to start a traditional sproutcore project with the provided components just use

# sc-init your-project

instead of

# sc-init your-project --template

That way, you'll end up with the correct buildfile right from the start. It might be confusing when you start with sproutcore but one should be aware that building sproutcore template applications is something different than building sproutcore applications with the provided desktop controls. Although, paths are provided to convert existing desktop like applications into template ones afterwards the opposite way is not supported (yet).


You need to add foundation as a dependency in your project's Buildfile:

config :all, :required => ["sproutcore/core_foundation", "sproutcore/foundation"]
0

精彩评论

暂无评论...
验证码 换一张
取 消