It's not the image that I'm concerned about coming from the server... it's the data I want to present in the new row that will come from the server. If I didn't need to find my object on click of the button, it wouldn't be an issue, but I need to find the object referenced in the row so I can dynamically create the data.
Also, I do not believe this pertains to the plugin itself, the issue occurs when I use the $.post function that is included with jQuery. Even when I try an alert on the calls results, I get the [object XMLHttpRequest] returned. Here's what I have so far that seems to at least present some HTML on the screen (still haven't determined why it didn't work with my earlier method) The original code called this: oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' ); oTable represents my table and nTr represents the row I'm working with. fnFormatDetails ina function that in the original case creates static html... but this is where I was trying to hit the server with the $.post call. This fnOpen function came with the DataTables plugin and it appends a <tr></tr> below the referenced row with the content coming from fnFormatDetails. This would return my new row, but the content would be "[object XMLHttpRequest] " instead of the view content. I exhausted Google on this... I couldn't even find anything similar to my issue. Which makes me thing I'm missing something small and obvious. However... since I could not get this working... I opted to append the row in my action. So, instead of calling the oTable.fnOpen function, I just call $.post to my action. In the action, I write something like this... render :update do |page| page["#my_id"].after(escape_javascript(render :partial=>"field_details")) end This appends my row beautifully, except the html returned seems to be over-escaped by the escape_javascript method. For example, my html close tags return as "<\/td>", so the tags never end up closing. But if I don't escape it, I get a javascript error saying "r is null". I believe it is failing on one of my </tr> tags. I appreciate any guidance you can give me on this. I have been trying to solve this sorting issue for days, now, with various methods... and just when I feel like I'm close, I run into a wall. Thank you so much for your help! Trish On Aug 5, 9:33 pm, Angel Robert Marquez <[email protected]> wrote: > Why hit the server again rather than have the initial response have the css > class for the returned image you want to toggle set to display: none and > modify the ui control to toggle the css class? > > On Thu, Aug 5, 2010 at 7:21 PM, Angel Robert Marquez < > > > > [email protected]> wrote: > > Do you want me to do all the research first and have the answers or do it > > out loud like we did last time? > > > I think the question might be better suited for the plugin developers. > > > On Thu, Aug 5, 2010 at 10:54 AM, Trish <[email protected]> wrote: > > >> Okay, so I am very new to this jQuery stuff, and it seems like I'm > >> just going round and round on this... so I'm hoping someone can help. > > >> I have a table that will have a image on each row that when click, it > >> adds a row with more details below the current row. The details will > >> all be pulled from rails. > > >> I am using the DataTables plugin for jQuery for my table and am basing > >> my code off of this example: > > >>http://datatables.net/examples/api/row_details.html > > >> The example adds the row without going to the server, so I have > >> modified fnFormatDetails to hit the server. > > >> my modified code is this: > > >> function fnFormatDetails ( oTable, nTr ) > >> { > >> return jQuery.post('<%= url_for :action=>"field_details" %>', {}, > >> null, 'html'); > >> } > > >> I have also tried multiple variations of this, and can't get anything > >> to work. > > >> I am hitting my action just fine, and it is parsing the view (as seen > >> with log statements), but when the row displays on the screen, I see: > > >> [object XMLHttpRequest] > > >> instead of the text. I have also tried just a plain > >> render(:text=>"some text", :layout=>"false") in my action, and have > >> the same results. > > >> All the documentation I see makes me believe that the $.post method > >> should be returning html. > > >> I have viewed this with FireBug, and it sees the response as the text > >> I gave. > > >> As a side note, I chose to use the $.post method instead of the $.get > >> method because $.get was returning a 304 error. I get the 200 code > >> for $.post. > > >> Also, I have tried this with both jQuery 1.4 and the jQuery instance > >> provided with the plugin. > > >> Thanks in advance! > >> Trish > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Ruby on Rails: Talk" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<rubyonrails-talk%2Bunsubscrib > >> [email protected]> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

