Hi Tim,
I think that in your example there a couple of issues:
<div part="div-members">
<collection:members"/>
</div>
Instead of:
<div id="div-members">
<collection:members"/>
</div>
And one of these:
update="members"
updates="#members"
Instead of:
update="#members"
Apart from that, I think they would exactly the same thing.
Regards,
Ignacio
El 14/01/14 21:27, Tim Griffin escribió:
> Ah, thanks for the clarification, Bryan. Time for me to re-read the
> manual, apparently!
>
> With the agility example from the manual, is there really any difference
> to Hobo between this (the original):
>
> <aside:>
> <h2>Project Members</h2>
> <collection:members part="members"/>
> <form:memberships.new update="members" reset-form refocus-form>
> <div>
> Add a member:
> <name-one:user/>
> </div>
> </form>
> </aside:>
>
> and this (other than being slightly more typing)?
>
> <aside:>
> <h2>Project Members</h2>
> <div id="div-members">
> <collection:members"/>
> </div>
>
> <form:memberships.new update="#div-members" reset-form refocus-form>
> <div>
> Add a member:
> <name-one:user/>
> </div>
> </form>
> </aside:>
>
>
> Tim
>
>
>
> On Tue, Jan 14, 2014 at 2:56 PM, Bryan Larsen <[email protected]
> <mailto:[email protected]>> wrote:
>
> A part necessarily has to be an independent context: Hobo needs to
> be able to render the part in isolation -- after all, when you
> update it, that's all it's rendering.
>
> So I don't think it's your context that's shifted, it's just that
> you lost your local variables. You have to explicitly tell Hobo
> about local variables:
> http://hobocentral.net/manual/ajax#local-variables
>
> Bryan
>
>
>
> On Tue, Jan 14, 2014 at 2:47 PM, Tim Griffin <[email protected]
> <mailto:[email protected]>> wrote:
>
> Mystery solved.
>
> I found the culprit: my use of a "part" attribute on the div
> that contained the tag trying to reference the attribute of the
> enclosing tag. And, not having included this little detail in my
> original posting, that suggests why, Ignacio, you were not able
> to reproduce the same issue.
>
> So, in my full example, I should have shown my use of the part
> attribute:
>
> <def tag="plans" attrs="showspecialcontrols">
> <div part="special_plans"
> <my-table-plus:plans fields="plan_no,
> plan_type" showmycontrols="&showspecialcontrols">
> ...
> </div
> </def>
>
> Including the "part" attribute shifted the context for my
> subsequent tag my-table-plus.
>
> Since I've just hit this very same problem with another example,
> I would really love to know *why the "part" attribute shifts
> context*. And, how is specifying "part" any different than
> simply tagging the <div> with an ID and using the
> updates="#div1,#div2" syntax. *Is "part" now an antiquated way
> of doing things?*
>
> Tim
>
>
>
>
> On Mon, Jan 13, 2014 at 8:54 PM, Tim Griffin
> <[email protected] <mailto:[email protected]>> wrote:
>
> Hey Kevin:
> Good idea, but that just produces:
>
> undefined method `showspecialcontrols' for nil:NilClass
>
> Hey Ignacio:
> How odd that you can't reproduce it. I'm currently using
> Hobo 2.0.1 - is there anything in a later version that would
> have altered this behaviour?
>
> So, evidently when calling my-table-plus:plans there is no
> "parent" (which I guess makes sense).
>
> Deeper in my own definition of my-table-plus, I pass an
> attribute on as a value to another custom tag with no
> problem (as do many other Hobo tags). This difference here,
> is that the call to <my-table> doesn't shift the context.
>
> <def tag="my-table-plus" attrs="sort-field, sort-direction,
> sort-columns, showspecialcontrols" >
> ...
> <my-table showspecialcontrols="&showspecialcontrols" ....>
> <field-heading-row:>
>
> But, I'm curious why you can't replicate the behaviour....!
>
> Tim
>
>
>
> On Mon, Jan 13, 2014 at 3:05 PM, kevinpfromnm
> <[email protected] <mailto:[email protected]>> wrote:
>
> Have you tried using this_parent.showspecialcontrols?
>
>
> On Sunday, January 12, 2014 8:32:10 AM UTC-7, Tim
> Griffin wrote:
>
> Hi all,
>
> This may seem really basic, but it tripped me up for
> a while because I'd forgotten a basic Hobo tenet:
> /Always be aware of context/.
>
> I'd defined a tag that calls another custom tag as
> follows:
>
> <def tag="plans" attrs="showspecialcontrols">
> <my-table-plus:plans fields="plan_no,
> plan_type" showmycontrols="&__showspecialcontrols">
> ...
> </def>
>
>
> But, for the longest time, the highlighted attribute
> call generated:
>
> undefined method `showspecialcontrols' for #<#<Class:...
>
> It took me a while to realize/remember that by
> including "plans" in my call to <my-table-plus:> I'd
> shifted the context for the attribute I'd passed in.
> Hobo was now looking for a
> /showspecialcontrols/ method on a plan, which didn't
> exist.
>
> Unless someone can contribute an alternate solution,
> I couldn't see a way around this without assigning
> the /showspecialcontrols/ attribute to an instance
> variable:
>
> <def tag="plans" attrs="showspecialcontrols">
>
> <!-- We need an instance variable here otherwise
> context is confused within call to my-table-plus -->
> <% @show = showspecialcontrols %>
>
> <my-table-plus:plans
> fields="..." showmycontrols="&__@show">
>
>
> Tim
>
>
>
>
>
> --
> You received this message because you are subscribed to
> a topic in the Google Groups "Hobo Users" group.
> To unsubscribe from this topic, visit
>
> https://groups.google.com/d/topic/hobousers/aHVmZTwPKn4/unsubscribe.
> To unsubscribe from this group and all its topics, send
> an email to [email protected]
> <mailto:hobousers%[email protected]>.
> To post to this group, send email to
> [email protected]
> <mailto:[email protected]>.
> Visit this group at
> http://groups.google.com/group/hobousers.
> For more options, visit
> https://groups.google.com/groups/opt_out.
>
>
>
> --
> You received this message because you are subscribed to the
> Google Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to [email protected]
> <mailto:hobousers%[email protected]>.
>
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "Hobo Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/hobousers/aHVmZTwPKn4/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected]
> <mailto:hobousers%[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.
--
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.