Search code examples
smalltalkaida

In-place editable field in web grid


I'm trying to add an in-place editable field to a web grid like this:

WebGrid new
  columnNames: #('Test');
  columnAspects: #(nil);
  column: 1 addBlock: [:o | WebInPlaceEditableText aspect: #test for: o];
  collection: self objects.

However, when pointing my browser to the page containing this element, I get:

Too late to add page headers, page is already streaming to response!


Solution

  • Add the following code at the beginning of the method where your code resides:

    ScriptaculousLibrary ensure
    

    This library initialization call is otherwise done automatically by WebInPlaceEditableText but because in your case it resides in a block which is executed late in page streaming phase, when a page is already composed, this error occurs. Therefore the manual library initialization is needed.