David Mitchell
2006-Jul-23 11:17 UTC
[Rails] [OT] Ajax design question - breaking a table with text...
Hello everyone,
I''ve got a table of data that looks like the following:
...
<tr>
<td>Field 1</td>
<td>Field 2</td>
<td><%= link_to "Info about Field 1", ... %></td>
<td><%= link_to "Info about Field 2", ... %></td>
</tr>
I''d like the user to be able to click on "Info about Field
1", and
have a block of info appear between this <tr> and the next <tr>.
The
following record would move down, and the "Info about Field 1 content"
would be inserted between the two records.
The only way I can think of doing this is to insert an empty <div
id="Field1_content"></div> immediately following </tr>,
then load the
following into it when the user clicks on "Info about Field 1":
</table>
<p>Here''s lots of exciting info about Field 1</p>
<table>
<tr>
...
In other words, close off this table, insert a paragraph of text, then
start a new table to hold the content of all following rows. While I
think I can get this looking good onscreen, the code looks UGLY - I''ve
broken up a single table into two, separated by a bunch of text. The
code would look like:
<table>
<tr>
<td>...</td>
...
</tr>
<tr>
<td>...</td>
...
</tr>
</table>
<p>Here''s lots of exciting info about Field 1</p>
<table>
<tr>
<td>...</td>
</tr>
...
</table>
Is there a better approach generically for this sort of situation?
I''m sure this is probably Web Dev 101 stuff these days, but I never
made it to the classroom!
Thanks in advance
Dave M.
Kevin Olbrich
2006-Jul-23 14:13 UTC
[Rails] [OT] Ajax design question - breaking a table with text...
On Sunday, July 23, 2006, at 9:17 PM, David Mitchell wrote:>Hello everyone, > >I''ve got a table of data that looks like the following: >... ><tr> > <td>Field 1</td> > <td>Field 2</td> > <td><%= link_to "Info about Field 1", ... %></td> > <td><%= link_to "Info about Field 2", ... %></td> ></tr> > >I''d like the user to be able to click on "Info about Field 1", and >have a block of info appear between this <tr> and the next <tr>. The >following record would move down, and the "Info about Field 1 content" >would be inserted between the two records. > >The only way I can think of doing this is to insert an empty <div >id="Field1_content"></div> immediately following </tr>, then load the >following into it when the user clicks on "Info about Field 1": ></table> ><p>Here''s lots of exciting info about Field 1</p> ><table> > <tr> >... > >In other words, close off this table, insert a paragraph of text, then >start a new table to hold the content of all following rows. While I >think I can get this looking good onscreen, the code looks UGLY - I''ve >broken up a single table into two, separated by a bunch of text. The >code would look like: ><table> > <tr> > <td>...</td> > ... > </tr> > <tr> > <td>...</td> > ... > </tr> ></table> ><p>Here''s lots of exciting info about Field 1</p> ><table> > <tr> > <td>...</td> > </tr> > ... ></table> > >Is there a better approach generically for this sort of situation? >I''m sure this is probably Web Dev 101 stuff these days, but I never >made it to the classroom! > >Thanks in advance > >Dave M. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsIf it would work, I would insert this below the current line... <tr><td colspan=4> Text block with info </td></tr> I have a feeling that this won''t work well, there are issues with replacing table elements in some browsers (like IE). _Kevin www.sciwerks.com -- Posted with http://DevLists.com. Sign up and save your mailbox.
Nathaniel Brown
2006-Jul-23 23:15 UTC
[Rails] [OT] Ajax design question - breaking a table with text...
With your table, ensure that you have the proper <tbody> tag around all
<tr>
elements. Have the links within each of the TR''s that should display
the
info below have an id like so
<table>
<tbody>
<tr>
<td>
<table>
<tbody id="row1">
<tr>
<td></td>
<td>link for info with id...</td>
<td>link for info with id...</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table>
<tbody id="row2">
<tr>
<td></td>
<td>link for info with id...</td>
<td>link for info with id...</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
And you should be able to use RJS like so...
page.insert_html :bottom, params[:row], render(:partial =>
''rowHelpInfo'')
FYI: I got that working on IE as well.
-NSHB
On 23 Jul 2006 14:16:19 -0000, Kevin Olbrich <
devlists-rubyonrails@devlists.com> wrote:>
>
> On Sunday, July 23, 2006, at 9:17 PM, David Mitchell wrote:
> >Hello everyone,
> >
> >I''ve got a table of data that looks like the following:
> >...
> ><tr>
> > <td>Field 1</td>
> > <td>Field 2</td>
> > <td><%= link_to "Info about Field 1", ...
%></td>
> > <td><%= link_to "Info about Field 2", ...
%></td>
> ></tr>
> >
> >I''d like the user to be able to click on "Info about
Field 1", and
> >have a block of info appear between this <tr> and the next
<tr>. The
> >following record would move down, and the "Info about Field 1
content"
> >would be inserted between the two records.
> >
> >The only way I can think of doing this is to insert an empty <div
> >id="Field1_content"></div> immediately following
</tr>, then load the
> >following into it when the user clicks on "Info about Field
1":
> ></table>
> ><p>Here''s lots of exciting info about Field 1</p>
> ><table>
> > <tr>
> >...
> >
> >In other words, close off this table, insert a paragraph of text, then
> >start a new table to hold the content of all following rows. While I
> >think I can get this looking good onscreen, the code looks UGLY -
I''ve
> >broken up a single table into two, separated by a bunch of text. The
> >code would look like:
> ><table>
> > <tr>
> > <td>...</td>
> > ...
> > </tr>
> > <tr>
> > <td>...</td>
> > ...
> > </tr>
> ></table>
> ><p>Here''s lots of exciting info about Field 1</p>
> ><table>
> > <tr>
> > <td>...</td>
> > </tr>
> > ...
> ></table>
> >
> >Is there a better approach generically for this sort of situation?
> >I''m sure this is probably Web Dev 101 stuff these days, but I
never
> >made it to the classroom!
> >
> >Thanks in advance
> >
> >Dave M.
> >_______________________________________________
> >Rails mailing list
> >Rails@lists.rubyonrails.org
> >http://lists.rubyonrails.org/mailman/listinfo/rails
>
> If it would work, I would insert this below the current line...
>
>
> <tr><td colspan=4> Text block with info </td></tr>
>
> I have a feeling that this won''t work well, there are issues with
> replacing table elements in some browsers (like IE).
>
>
> _Kevin
> www.sciwerks.com
>
> --
> Posted with http://DevLists.com. Sign up and save your mailbox.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
Kind regards,
Nathaniel Brown
President & CEO
Inimit Innovations Inc. - http://inimit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060723/9224bc0d/attachment.html