Hello RoR community,
I have a problem with the helpers in Rails 1.2.3.
HTML:
<table border="0" cellspacing="0" cellpadding="0" id="questionTable" class="sortable"> <thead> <tr> <th>#</th> <th>Question name</th> <th>Class</th> <th>Type</th> <th>Level</th> <th>Question text</th> <th> </th> </tr> </thead> <tbody> <tr> <th>1</th> <th>test</th> <th>test</th> <th>test</th> <th>test</th> <th>test</th> <th>test</th> </tr> <tr> <th>2</th> <th>test2</th> <th>test2</th> <th>test2</th> <th>test2</th> <th>test2</th> <th>test2</th> </tr><!-- and much more --> </tbody> </table>
What do I need? I need to insert into the tbody the tr record (<tr><td>..</td></tr>) before all tbody's tr elements.
How did I try? RJS:
page.insert_html :before, page.select('#questionTable tbody tr').first, render(:partial => 'question', :locals => { :q => question_copy })
Not working, but JS:
new Insertion.After($$("#questionTable tbody").first(), "<tr><td>asdasdas</td></tr>");
Work's perfectly.
How I can solve this problem?
Dmitry