Thanks for the advice - I will definitely give it a look. Lukas
Am Montag, 7. Mai 2012 16:07:14 UTC+2 schrieb Rolf Langenhuijzen: > > For dirty code you can use the onsuccess handler of your ajax call not? I > mean, you click the row, you load ajax content which also has a > request.onSuccess which you can use to scan your updated DOM (it is > updated, else you won't see it in the browser as well!) and hook up the new > events to turn text into input. > > Though, I think you should look into Behavior/Delegator of mr Nutron: > https://github.com/anutron/behavior > It kicks ass. > > You might need to change your whole setup though, but it's worth it in the > end and your future projects. > Using this you can use data-* attributes to describe behavior for > elements, for example that "onclick turns an element into an input field" > (using some small class you write for this). You can also load in the ajax > content and as soon as it's added to the dom it will automatically apply > new filters (in this case the "turn text into input"). > > Seriously, check out the github docs (pretty useful) and also: > http://www.clientcide.com/code-releases/clientcide-3-0-behavior-1-0-mootools-development-and-so-much-more/ > and also: http://dev.clientcide.com/ (also see demos link in the top > right corner). > > > Rolf > > > On Monday, May 7, 2012 3:08:00 AM UTC+2, Lukas Oberbichler wrote: >> >> Hello, >> >> I want to tell you about my problem as detailed as I am able to and show >> you the relating code at jsfiddle. >> >> I am programming in JSP with a mvc architecture. >> I select a database, show the rows of the database in the view and now i >> want to make a click on one of the rows and get the corresponding contents >> of the second database per AJAX beneath the row i clicked. >> This works without a problem. >> >> Now i want to make this corresponding content also clickable - turn the >> text inside the <td>'s into <input> fields to make them editable. >> >> The problem is, that I am not able to select this content anywhere. >> Of course I am not able to add a event at the beginning because the AJAX >> request was not send then and the class/id won't exist at this time. >> I am but also not able to get the elements in the onSuccess method of the >> Request.HTML class and add a click event to them. >> >> I think the problem is, that the respond is never added to the dom tree. >> >> I searched the internet and this group, tried various ways, but neither >> of them actually solved my problem. >> >> *To sum it up:* >> >> I have two database tables: >> >> >> - Database 1 >> - Database 2 - is linked through an index with Database 1 >> >> >> At first Database 1 gets displayed - the user clicks on any of the rows >> of Database 1 - beneath the clicked row the associated Database 2 content >> turns up (AJAX request). >> Now i want to click on any of the rows of the associated Database 2 >> (which has a class). >> >> The servlet (controller) respond is normal html. >> >> In the jsfiddle example I have commented out the only way I was able to >> make it work because it is (in my eyes) a pretty bad way to nest all the >> events in the onSuccess method of the Request class. >> >> jsfiddle <http://jsfiddle.net/dXHnt/1/> >> >> Thank you in advance! >> >> >> >>