#47 ✓invalid
pierre

Strange behavior with insert_bottom and insert_top

Reported by pierre | April 15th, 2010 @ 05:00 PM

Hi,

I was playing with Nitrogen 2.0.0 and I wanted to try the insert_top action :

-module (bug). -compile(export_all). -include_lib("nitrogen/include/wf.hrl"). -include("records.hrl").

main() -> #template { file="./site/templates/bare.html" }.

body() ->

[
    #link{id=button, text="add a new H1", postback=add_h1}
].

event(add_h1) ->

wf:insert_top(button, #h1 {text="new heading 1"}).

The problem is that each new heading behave like the link.
It seems to happen when we want to insert a new element before or after a link.
In fact, the new element is inserted INSIDE the link but not before or after.

I'm totally new to the framework, so maybe i'm missing something...

Thanks

Pierre

Comments and changes to this ticket

  • Brian O

    Brian O April 22nd, 2010 @ 01:37 PM

    Hi Pierre,

    I think this is the expected behavior. When you insert_bottom() or insert_top(), you are inserting INTO the element that you identify. If you want to insert above or below, you might try creating a panel above or below and then wf:insert_bottom() or wf:update() into that panel. Alternatively, you might want to request that insert_above() and insert_below() functions are added to the API.

  • Rusty Klophaus

    Rusty Klophaus June 14th, 2010 @ 06:20 PM

    • State changed from “new” to “invalid”

    Brian O is correct. You should use insert_bottom and insert_top on a panel (which equals a div).

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Nitrogen Web Framework for Erlang

People watching this ticket

Pages