It is a function of component to render itself. prependJavascript is a method of ajax request target that evaluates javascript before component is replaced. Those are two different things.
On 4/14/07, Alexei Sokolov <[EMAIL PROTECTED]> wrote: > Here is a question: where should I put prependJavascript("whatever") ? in > onSomething(AjaxRequestTarget target) method of say AjaxLink? why? isn't is > a function of a component itself to render itself? > > Alex > > > On 4/13/07, Matej Knopp <[EMAIL PROTECTED]> wrote: > > > > First you should realize that wicket is not about javascript > > components. Wicket is about serverside components that can be > > partially updated using ajax. > > > > However, that doesn't mean that "javacript components" are not > > possible. But to implement something like that you probably need a bit > > deeper knowledge of wicket works. > > > > If I understand correctly you want a listview that can add elements > > without refreshing the whole component? This is not a trivial thing to > > do, but certainly it's possible to accomplish. > > > > First, I wouldn't use ListView for this. I suggest you looking at how > > RepeatingView works. You can either use it as base class or roll your > > own repeater that suits your needs (children identity, ids, etc.). > > > > To ajax-update element that is not yet in page markup (newly added > > list element) i suggest creating dummy DOM element in > > AjaxRequestTarget.prependJavascript that is on desired > position within > > list parent and has proper id. You can then add the new component to > > AjaxRequestTarget and it will be shown. > > > > -Matej > > > > On 4/13/07, Alexei Sokolov <[EMAIL PROTECTED]> wrote: > > > This discussion is going nowhere. > > > > > > Adding <li> tag is not browser safe? First, it is not true; second - > it's > > > not the point. Let's say i want to call 'addNewItemToMyList()' function > on > > > the client instead. How should I do this so that my component is > *reusable* > > > in both cases - when I update it from ajax call or using regular page > > > update. Behavior seems like a good fit, but it is not possible to remove > a > > > behavior from the component, so one time use behaviors are not possible. > > > Here is how it might work: you have a behavior that generates whatever > you > > > want when component is added to ajaxrequesttarget, sometimes overriding > > > markup generated by the component. This behavior is added by the > component > > > when you call certain component methods (like itemAdded()) and should > remove > > > itself from the component after request processing is done. This way you > can > > > customize output of ajaxrequesttarget.add(component). Also, at the > moment > > > javascript files (and other resources) are nicely packages, but there > are no > > > mechanism for javascript namespaces (i'd like to see all > component-related > > > javascript to reside in its own private namespace on the client, so > there > > > are no conflicts). > > > > > > I have a feeling that wicket is not javascript-friendly. > AjaxRequestTarget > > > seems to be taconite limited edition (tm) (see > > > http://taconite.sourceforge.net/), and it is not clear > to > > > me how to create reusable ajax/javascript widgets using wicket. I hope > it is > > > possible, but not very well documented. > > > > > > > > > Alex > > > > > > On 4/13/07, Korbinian Bachl <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > from the wiki: > > > > > > > > " > > > > > > > > What you typically want to do is to redraw the complete <ul></ul> > > > > part, because most browsers really don't appreciate when you replace > > > > parts of a tag, especially when you are working with a <table>. > > > > > > > > " > > > > just adding a line <li> there with JS isnt browsersafe - you can > however > > > still do it if you provide a own ListView implementation. > > > > > > > > > > > > ________________________________ > > > Von: [EMAIL PROTECTED] > > > [mailto: [EMAIL PROTECTED] Im > > > Auftrag von Alexei Sokolov > > > > Gesendet: Freitag, 13. April 2007 18:14 > > > > An: [EMAIL PROTECTED] > > > > Betreff: Re: [Wicket-user] ajax / javascript widgets in wicket > > > > > > > > > > > > > > > > That solution will replace <ul> element and all of its children, which > is > > > not what I want. > > > > > > > > I need something like one-time-use javascript behavior, which can be > > > attached to a component and then discarded after first rendering. > > > > > > > > Alex > > > > > > > > > > > > On 4/13/07, Korbinian Bachl <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > We had this question 2 days ago, solution is in wiki: > > > > > > > > > > > > > > http://cwiki.apache.org/WICKET/how-to-repaint-a-listview-via-ajax.html > > > > > > > > > > the List actions itself like add and delete are part of List and you > > > just would have to ListView.setList(yourListInHere) prior to repainting > the > > > markupcontainer with ajax. > > > > > > > > > > Regards > > > > > > > > > > > > > > > > > > > > ________________________________ > > > Von: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] Im > > > Auftrag von Alexei Sokolov > > > > > Gesendet: Freitag, 13. April 2007 00:41 > > > > > An: [EMAIL PROTECTED] > > > > > Betreff: [Wicket-user] ajax / javascript widgets in wicket > > > > > > > > > > > > > > > > > > > > Hello guys, > > > > > > > > > > I have a question about designing ajax/javascript widgets using > wicket. > > > Here is my problem: > > > > > > > > > > I have a form, which I submit using ajax submit button and I have a > list > > > view like this: > > > > > > > > > > <ul> > > > > > <li wicket:id="item">blah</li> > > > > > </ul> > > > > > > > > > > > > > > > What I want to do is: > > > > > - add a new <li> element to the list (but don't change other DOM > nodes > > > in the document) > > > > > - call a javascript function to apply some visual effects to the > item > > > > > > > > > > I want a similar method for removing items from the list, updating > > > items, etc. > > > > > > > > > > How do I design such widget? > > > > > > > > > > Thank you, > > > > > Alex > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share > > > your > > > > > opinions on IT & business topics through brief surveys-and earn cash > > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > > _______________________________________________ > > > > > Wicket-user mailing list > > > > > [EMAIL PROTECTED] > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > > > Join SourceForge.net's Techsay panel and you'll get the chance to > share > > > your > > > > opinions on IT & business topics through brief surveys-and earn cash > > > > > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > _______________________________________________ > > > > Wicket-user mailing list > > > > [EMAIL PROTECTED] > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------- > > > Take Surveys. Earn Cash. Influence the Future of IT > > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Wicket-user mailing list > > > [EMAIL PROTECTED] > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Wicket-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Wicket-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/wicket-user > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/wicket-user