On Lunes, 14 de Noviembre de 2011 12:49:55 Ole Rummel escribió:
> Hi,
> thanks for the quick answer. The above is just an example to get the
> idea of live updating.
> 
> What I have is a model Status with a column :summary and the following
> overrides
> 
> 
> def summary_form_column(record, options)
>    text_area :record, :summary,  options.merge(:size =>
> "80x40", :value => record.summary || record.default_summary)
> end
> 
> def summary_to_html__form_column(record)
>   record.summary_to_html
> end
> 
> 
> Currently I see the last version of my :summary rendered as html. What
> I want is live rendering of the html during editing of the text_area.
> So I need to somehow get the summary_to_html_form dynamic.
> 

This is simpler than your example of products and total, because there is no 
associations involved. You only need to set update_columns for summary column:
conf.columns[:summary].update_columns = :summary_to_html

It will be updated in change event (when focus is lost). However, there was a 
bug and update_columns it wasn't working for textareas, it will be fixed in 
next version. Also, you can enable live updating on keyup event for summary 
column addind this javascript code:

  $('text_area.summary-column.update_form').live('keyup', function(event) {
    var element = $(this), value = element.val();
    ActiveScaffold.update_column(element, element.attr('data-update_url'), 
element.attr('data-update_send_form'), element.attr('id'), value);
    return true;
  });


Maybe you will have to improve that code with timeouts so you don't do too 
many requests, but it's up to you.

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to