Comments (7)
This is feasible by making sure the _TemplatedMixin that is used to load the view template is mixed into the view itself.
See a working tentative here: https://github.com/cjolif/dojox_application/commit/4a73a00d66174290a7e689e0039bf87f451bb12a
There might be cleaner way to achieve that though.
from dojox_application.
This used to be available as part of each view template I thought, but the mixins may have changed a little bit. The view classes can really do whatever is desired in this regard, so if someone extends a view and mixes in the appropriate templatedMixin logic, it should work fine. All that said, we should be careful about doing or encouraging more connections/events like this than are necessary. The convience tends to lead to too much work that could often be accomplished by less with event bubbling.
from dojox_application.
@dmachi this is indeed available part of the templating mechanism. But as of today the _TemplatedMixin instance is not mixed into the view and thus this is not working because it can't call the methods defined on the view. Even if I agree with you that this convenience might not always be good to use, I think it does have value in some cases? And as we are pretty close to getting it done, I think it would be worthwhile having it? If you agree I will work on a pull request that implements this (something probably very similar to the first draft I've linked above).
from dojox_application.
In dojox.app, it's recommend to use two ways to bind events:
- in view level, it's better to bind event by dojo.connect or dojo.on in the view's init(), and disconnect the event in view's destroy()
- in application level, it's better to create a controller to implement dojox.app.Controller and use the controller to bind events. for example:
events = {
"#buttonId :click": clickHandler,
"div > .selected : click": selectedHandler
};
in dojox.app.View class, render() method is independent on dojo, the widget created from template HTML should be a child of view, not mixin to view. view should be an object, not a widget. If the template is a jQuery HTML template, how to mixin the Jquery widget to view?
from dojox_application.
To answer:
in dojox.app.View class, render() method is independent on dojo, the widget created from template HTML should be
a child of view, not mixin to view. view should be an object, not a widget. If the template is a jQuery HTML template,
how to mixin the Jquery widget to view?
I agree. And actually what I'm mixing into the View is not a widget (_WidgetBase) this is a _TemplatedMixin "only"? But I agree there might be cleaner way to achieve that (see my initial comment). Do you have suggestions? Maybe a Dojo-specific View? But then how would it be triggered? I don't think the current mechanism allows one to extend View and plug his extension in?
from dojox_application.
View should be an instance of an object. It could simply generate html or it could render a template and attach functionality to that block of html. However, this is really at the conceptual level. We should make sure we don't depend on a dojox.app.View being there (or something extending that), but in practice most of our stuff probably will.
The template html for a view is not itself a widget, it is simply html that gets processed and placed by whatever view function is initializing it. This of course is free to ignore dojo, _Widgetbase, etc. However, for our views that use templates (most of them) I would expect to use _WidgetBase and _TemplatedMixin as base classes for the view. That is the "view" becomes a single dojo widget with the optional template being the content of that widget. If one were to include a jquery widget, it would either be a child of the view 'widget' (placed inside that view widgets html) or one could implement a View class with jquery itself.
All of this allows the simplest case to simply be a function or more complex objects like our view widget.
from dojox_application.
As of today I'm afraid we rely on View being here. But you are right we should probably make sure this is not the case anymore longer term. The Load controller should be more flexible and be able to load something else than the predefined View object.
I will try to work on a pull request with that in mind.
from dojox_application.
Related Issues (20)
- Problem with a scrollable view where it scrolls down a little when transitioning to a view which was scrolled to the bottom. HOT 3
- Problem on IE with History and HistoryHash when transitioning back to the default view. HOT 2
- There is a problem with the has based config support on IE. HOT 1
- History should have a config option to automatically create the full url hash from the selected children on the app. HOT 1
- build system enhancements HOT 1
- The app build support was not updated to deal with the has-config support when it was added. HOT 4
- iOS VoiceOver Support HOT 1
- Preloader Application on first load and on View switches HOT 3
- borderLayoutApp test file name issue HOT 3
- Transitioning View Fails Randomly HOT 11
- There is a problem with the Transition controller when transitioning across nested views. HOT 1
- beforeDeactivate and afterDeactivate can be called for a view on the initial display without ever calling beforeActivate and afterActivate HOT 2
- app build support gets an error if a template file is used by more than one view.
- View beforeDeactivate, afterDeactivate, beforeActivate, and afterActivate are not always called correctly for nested views. HOT 1
- Problem with a multipart defaultView set on a child of a nested view. HOT 1
- Lazy-loaded views "flash" into view when initially placed HOT 5
- Check in transition to check for matching views can fail with nested views. HOT 1
- dojo 10.0.1 was released HOT 1
- dojo 1.10.3 release HOT 1
- ScrollableView issue on imageupload from Android
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dojox_application.