On 2-Mar-07, at 10:54 PM, Wai T. wrote:
seems to work pretty well - you’ll just have the same onclick JS
Actually, after some researching, I found that it is possible to have
onmouseover events for TR cells. Now, the problem is how to do that
elegantly (with AJAX?) to pass parameters back to the controller.
My idea would be to have a hidden text fields or check box for each
table row, that will get toggled. But storing the values in hidden
fields seems like a hack. Does anyone have a better idea?
<tr class="<%= row_class %>"
= row_class %>’” style=“height: 45px;”>
the above will handle the highlighting requirement for each row -
where row_class is the ‘normal’ not highlighted class - and
‘selected’ is the class for a highlighted row.
erb is assigning a row_class for me, as I want to alternate the
colors for each row. This can be accomplished by iterating over your
detail records and assigning an alternating row class:
@work_order_items.each_with_index do |line_item, line_count|
row_class = line_count%2 == 0 ? “even” : “odd” #note there is
a helper provided by rails to do this - can’t remember the helper name
as for ‘hotlinking’ you’ll need to have each cell (td) call some
assume you’re thinking of an ajax action - take a look at
remote_function in the api docs, using the (undocumented?) :with
| 'your_row_id', url =>
'your url', :id => @line_item.id %>"> @line_item.description
that should be enough detail to you get you started. Rails helpers
up this skill - plus CSS. Rails (imo) makes it a bit easier to deal
with these topics, but you’re inevitably going to find yourself in
circumstances where you’re gonna get just plain lost. Use view source
to see what the helpers do for you, and grab firebug to help debug
when things aren’t going well.
you’re on your own now cowboy - enjoy the ride!