I have a tabular (it's a form actually) with text_fields and buttons.
I wanted to diplay a particular row when a button is set to 'yes'.
Everything's working fine except, that my new row is diplayed at the top
of the array and not where I want. I can do page.add_html/delete and
specify bottom, but I don't understand why my snippet doesn't work.
This looks perfectly correct to me. I do something similar but with an
unordered list, and div's around each of the <li> lines. replace_html
cleanly replaces just the line I want to change.
I have the same snippet for lists too and it works actually.
I wonder if it is just a bug related to tables.
Maybe. I'm waiting for other replies before going deeper in this problem
to see where's the bug. I'm wondering if it is due to the 'form' fields.
I almost never use a table anymore now that I've learned css.
Actually, I have an application displaying a whole bunch of data (think of
thousands rows/columns of structured data). So tabulars are perfect for
me
Maybe. I'm waiting for other replies before going deeper in this problem
to see where's the bug. I'm wondering if it is due to the 'form' fields.
It's not a bug with tables. Ajax works on XHTML DOM elements. Tables use a different DOM. The explanation of the situation is on MSDN. If you're going to use Ajax, you're either going to use CSS, or you're going to end up with some very ugly code because <tr>'s can't be updated / replaced. If you really need to use tables, the best way I've heard of is to replace your
<table>
<tr></tr>
</table>
It seems you can do a page.replace on a <tbody>. I haven't tried it. My recommendation is to bite the bullet and learn a little CSS. You can use absolute positioning on an <li> to get the table effect very easily, your code will be lots cleaner, and you can style the result in ways you'll never be able to with a table. OTOH, I hear the XHTML DOM is going to be extended and CSS3.x is going to include tables. If you can wait
It seems you can do a page.replace on a <tbody>. I haven't tried it.
Unfortunately, it doesn't work either I will forget about this AJAX
trick.
My recommendation is to bite the bullet and learn a little CSS. You can use
absolute positioning on an <li> to get the table effect very easily, your
code will be lots cleaner, and you can style the result in ways you'll never
be able to with a table.
You're probably right, but at this point on I don't have the time to learn
CSS and replace the 200 tables of my application Maybe in the RC2...
OTOH, I hear the XHTML DOM is going to be extended
and CSS3.x is going to include tables. If you can wait