Using #api{} for the postback works. It's simple enough for what I'm trying
to do. Thanks a lot.
On Friday, 13 April 2012 23:01:26 UTC-4, Jesse Gumm wrote:
> Hi Jeremy,
> It's definitely true that a lot of wiring like that can indeed slow it
> down in a browser with a slower javascript engine.
> I do think the best solution is something like a hard wiring event,
> maybe a hard_events attribute that can attempt to intelligently assign
> events to html onclick attributes and the like.
> An alternative you could try to use without reworking the nitrogen
> elements is to use the #api element and then make the links with
> directly typed links.
> IE
> body() ->
> wf:wire(#api { name=my_postback, tag=links }),
> [
> "<a href=\"javascript:;\"
> onclick=\"page.my_postback('link1')\">Link 1</a>",
> "<a href=\"javascript:;\" onclick=\"page.my_postback('link2')\">Link
> 2</a>"
> ].
> api_event(my_postback, links, Args) ->
> do_something_with(Args).
> That's at least a way to avoid having to deal with the slowdown of
> that many links and all the generated javascript associated with
> wiring events, though I admit it's not exactly the most
> straightforward approach.
> -Jesse
> On Fri, Apr 13, 2012 at 12:34 PM, Jeremy Raymond <jeraym...@gmail.com>
> wrote:
> > From what I can tell Nitrogen wires link post backs by running some
> > JavaScript on the client when the page loads. I have some pages with
> > hundreds of links that have postback and it's hella slow on IE. Is there
> > any alternate way to wire the postbacks (maybe hard wire it somehow in
> via a
> > script action on the link)?
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/nitrogenweb/-/G_FHgZo9b0MJ.
> > To post to this group, send email to nitrogenweb@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nitrogenweb+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/nitrogenweb?hl=en.
> --
> Jesse Gumm
> Owner, Sigma Star Systems
> 414.940.4866 || sigma-star.com || @jessegumm