Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
View without a template ....
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ladd.james  
View profile  
 More options Nov 5 2012, 8:13 pm
From: "ladd.james" <ladd.ja...@gmail.com>
Date: Mon, 5 Nov 2012 17:13:38 -0800 (PST)
Local: Mon, Nov 5 2012 8:13 pm
Subject: View without a template ....

I would like a view that just handles an existing set of DOM nodes (html
elements)
so I don't have a need for a template.

I'm not sure how to do this and I can't find an example in the Maria source.

How can I make a view that doesn't have a template?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Michaux  
View profile  
 More options Nov 5 2012, 8:22 pm
From: Peter Michaux <petermich...@gmail.com>
Date: Mon, 5 Nov 2012 17:22:51 -0800
Local: Mon, Nov 5 2012 8:22 pm
Subject: Re: View without a template ....

On Mon, Nov 5, 2012 at 5:13 PM, ladd.james <ladd.ja...@gmail.com> wrote:
> I would like a view that just handles an existing set of DOM nodes (html
> elements)
> so I don't have a need for a template.

> I'm not sure how to do this and I can't find an example in the Maria source.

> How can I make a view that doesn't have a template?

Something like the following might be appropriate

maria.ElementView.subclass(myApp, 'MyView', {

    constructor: function(rootEl) {
        maria.ElementView.call(this);
        this._rootEl = rootEl;
    },

    properties: {
        buildTemplate: function() {} // overrides
maria.ElementView.prototype.buildTemplate
    }

});

Is that what you were after?

Peter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ladd.james  
View profile  
 More options Nov 6 2012, 12:12 am
From: "ladd.james" <ladd.ja...@gmail.com>
Date: Mon, 5 Nov 2012 21:12:08 -0800 (PST)
Local: Tues, Nov 6 2012 12:12 am
Subject: Re: View without a template ....

I have tried the following and I get:

Uncaught Error: evento.addEventListener: Supported EventTarget interface
not found.

I'm passing in what I think is a valid rootEl - and - my buildTemplate has
no
body. Just like below.

I went down this path because when I'm creating a View I want the
'template' inserted
before the element identified by 'getContainerEl' but I could not achieve
that. Instead
opting to manually make the element in a higher template and then 'attach'
to it in
a subview.

A working example of attaching a Maria view to existing HTML (ie: no
template file) would
be very helpful.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Michaux  
View profile  
 More options Nov 6 2012, 3:35 am
From: Peter Michaux <petermich...@gmail.com>
Date: Tue, 6 Nov 2012 00:35:40 -0800
Local: Tues, Nov 6 2012 3:35 am
Subject: Re: View without a template ....

On Mon, Nov 5, 2012 at 9:12 PM, ladd.james <ladd.ja...@gmail.com> wrote:
> I have tried the following and I get:

> Uncaught Error: evento.addEventListener: Supported EventTarget interface not
> found.

> I'm passing in what I think is a valid rootEl - and - my buildTemplate has
> no
> body. Just like below.

> I went down this path because when I'm creating a View I want the 'template'
> inserted
> before the element identified by 'getContainerEl' but I could not achieve
> that.

If a view has child views then the the child views nodes should be
descendents of the view's node. They child view's nodes will not come
after the view's nodes.

> Instead
> opting to manually make the element in a higher template and then 'attach'
> to it in
> a subview.

> A working example of attaching a Maria view to existing HTML (ie: no
> template file) would
> be very helpful.

I had a mistake. The view's rootEl property cannot be set until after
the build process happens as the build process will not happen if the
rootEl has already been set. Storing in a rootToBe property works...

<!DOCTYPE html>
<html>
<head>
    <title>No Template</title>

</head>
<body>

    <div id="wrapper">
        <p class="clickable">click me</p>
    </div>

    <script src="http://michaux.ca/downloads/maria/rc4/maria.js"
type="text/javascript"></script>

    <script type="text/javascript">

        var myApp = {};

        maria.ElementView.subclass(myApp, 'MyView', {
            constructor: function(rootEl) {
                maria.ElementView.call(this);
                this._rootToBe = rootEl;
            },
            uiActions: {
                'click .clickable': 'onClickClickable'
            },
            properties: {
                buildTemplate: function() {
                    this._rootEl = this._rootToBe;
                }
            }
        });

        maria.Controller.subclass(myApp, 'MyController', {
            properties: {
                onClickClickable: function() {
                    alert('was clicked');
                }
            }
        });

        maria.addEventListener(window, 'load', function() {
            var view = new myApp.MyView(document.getElementById('wrapper'));
            view.build();
        });

    </script>

</body>
</html>

Peter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ladd.james  
View profile  
 More options Nov 6 2012, 6:31 pm
From: "ladd.james" <ladd.ja...@gmail.com>
Date: Tue, 6 Nov 2012 15:31:14 -0800 (PST)
Local: Tues, Nov 6 2012 6:31 pm
Subject: Re: View without a template ....

Great - Ill give this a try a.s.a.p


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »