It is weird, by all sense it should work.
I've done plenty of work like this in moo 1.11 but now in a new
version that this should break?

On Sep 17, 7:09 pm, Dimitar Christoff <[email protected]> wrote:
> I played with this too and even replaced ref to this.getNext().set("html"
> but it still messes up. Weird...
>
> Sent from my iPhone
>
> On 17 Sep 2010, at 04:34 PM, "Andrea Dessì" <[email protected]> wrote:
>
> Hi electronbender,
>
> I've seen queekly your code and maybe the onComplete function,
> passed to the request istance, doesn't know who is "chLip".
>
> I think you have to use ".bind()" for that funcion...
> Something like:
> ------------
> onComplete: function(theData){
>                this.set('html',theData.vest.cont);
>        }.bind(chLip)
> --------------
>
> so now the "this" inside onComplete is the chLip and you can use
> it's properties/funciotions.
>
> Andrea
>
> On Fri, Sep 17, 2010 at 14:45, electronbender 
> <[email protected]>wrote:
>
>
>
>
>
>
>
> > I'm generating a list of articles like so:
>
> > data.articles.each(function(article, ind){
> > var chLi = new Element('li').inject(rootUl);
> > var chA = new Element('a',{'href':'javascript:;'}).inject(chLi);;
> > var chLih = new Element('h4').set('html',vest.title).inject(chA);;
> > var chLip = new Element('p').set('html',vest.desc).inject(chLi);;
>
> > chA.addEvent('click',function(){
> >        var foo = new Request.JSONP({
> >        url: 'http://phpscrape.plavevski.net/index.php?src=a1&t=2&dta='+
> > vest.link,
> >        onComplete: function(theData){
> >                chLip.set('html',theData.vest.cont);
> >        }
> >        });
> >        foo.send();
> > })
>
> > The idea is that when a article title is clicked, the P tag html is
> > overwritten with the data fetched from the JSONP.
> > This works on the first click. The new html is loaded, and the P tag
> > html replaced.
> > If you click any other title after that, the first P tag html is
> > overwritten instead of the second. And so with any subsequent link
> > clicked.
>
> > See it in action here:http://jsfiddle.net/PegsX/2/
>
> > From what i gather, i am refferencing the correct tag:
> >        onComplete: function(theData){
> >                chLip.set('html',theData.vest.cont);
> >        }
>
> > But on execution only one and the same element is referenced?
> > What am i doing wrong?

Reply via email to