So I'm not entirely sure if this is a bind issue, a defer issue or
something else that I'm unaware of.

The scenario is this; the page loads, when this is done an
Ajax.PeriodicalUpdater call is made to load the 'dticketlist' with a
list of live tickets. I want to be able to click on any one of those
tickets and then load the full ticket data 'dmain'. The javascript I
have so far is:

Event.observe(window,'load',function() {
    new Ajax.PeriodicalUpdater('dticketlist','data/fetchliveticketview.php',{
        frequency:300,
        decay:2,
        onSuccess:function(evt) {
            $$('li.clickinc').invoke('observe','click',function(evt) {
                var elm;
                var id;
                elm = evt.element();
                id = elm.id || '(no id)';
                $('dmain').update('Updated text after clicking on '+id);
            })
        }
    });
    .....
});

This doesn't seem to do anything, not does Firebug report any errors.
As a test, I created a page with the list already in it:

<div id='dtest'><h6>Your Live Tickets</h6>
 <ul>
  <li id='M794751' class='clickinc'>M794751</li>
  <li id='M784800' class='clickinc'>M784800</li>
  <li id='M796555' class='clickinc'>M796555</li>
  <li id='M791122' class='clickinc'>M791122</li>
  <li id='M757562' class='clickinc'>M757562</li>
  <li id='M747790' class='clickinc'>M747790</li>
 </ul>
<div id='dmain'>This will be updated</div>

and used the following javascript:

Event.observe(window,'load',function() {
    $$('li.clickinc').invoke('observe','click',function(evt) {
        var elm;
        var id;
        elm = evt.element();
        id = elm.id || '(no id)';
        $('dmain').update('Updated text after clicking on '+id);
    });
});

and that works fine. So I don't really know if I need a bind here
somewhere (having read copious articles and snippets I'm not that much
wiser on its usage) or if infact I need a defer somewhere once the
PeriodicalUpdater has run to let the DOM update?

Or of course, I've got this completely wrong :) Any suggestions?

-- 
James Hoddinott

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to