Hi community,
I'm having a hard time getting a Javascript Extension for an
AppWithinMinutes livetable to work.
I have several livetable "enhancements" in it like changing background
color per field value which work properly.
As a reference I've used the example:
http://snippets.xwiki.org/xwiki/bin/view/Extension/Background+color+for+a+l…
Now I want to change the display of the value of a specific column, for
example to display an image or a button next to the value. This works only
for the last column in the livetable. All other rows look strange.
Example:
The simplified code:
```
document.observe("xwiki:livetable:newrow", function(ev){
$$('.sTxtUser').each(function(element){
var content = element.innerText;
if(content === undefined){
content = element.textContent;
}
element.replace('<td class="sTxtUser link typetext"
data-title="Username">"' + content + '"</td>')
});
});
```
I have 3 documents for the application with the following values for field
sTxtUser :
testuser1
test12345
anotheruser1
Using the above extension renders the livetable cells like this:
"""anotheruser1"""
""test12345""
"testuser1"
If I change the sort order:
"""testuser1"""
""test12345""
"anotheruser1"
So only the last row shows the desired output.
What am I doing wrong?
Regards,
Dennis