0

I have a property grid within which is currently a displayfield. I have been asked to make this particular field a multi-line field, so that text is wrapped around and carriage returns in the text are shown correctly.

I looked at a textareafield, but this seems to ignore readOnly: true, editable: false and methods of avoiding edits such as beforeedit: function(){return false;}.

I also tried to try and apply multiple line inserts (converting them to </br>) as part of the renderer within the displayfield , but this does not seem to work either.

What is the most efficient method of achieving this? Am I missing something simple in the API that provides the functionality I require?

I'd like to think this can be abstracted to a general case quite easily, but can provide code if deemed necessary.

EDIT:

To try and clarify my problem, I need a field that:

  1. Cannot be edited by the user; no text bar and typing in the field.

  2. Allows for multiple lines of text to be shown, by both word-wrap and by carriage returns/new lines

Think of a textareafield (expands to show all its contents) crossed with a displayfield (no editing capability).

David Smithson
  • 464
  • 2
  • 13
  • 33
  • wouldn't labels or column templates solve your problem? http://try.sencha.com/extjs/4.0.7/docs/Ext.grid.column.Template.1/viewer.html – martskins May 08 '14 at 16:14
  • Your question isn't really clear. Are you asking how to display line breaks when it's not editing? Or how to prevent editing? Or to show a read only copy when the user edits? – Evan Trimboli May 08 '14 at 16:19
  • I will try to clarify via an edit. – David Smithson May 08 '14 at 16:49
  • @lascort, your suggestions don't appear to fit propertygrids; could you point me towards a fiddle showing their implementation in propertygrids that demonstrates solving my problem? – David Smithson May 08 '14 at 16:56

1 Answers1

0

You might be looking for a textareafield with disabled set to true..
You can have new lines on the text with \n.

Hope that helps ! :)

Filipe Pereira
  • 198
  • 1
  • 10
  • The `textareafield` doesn't appear to word-wrap; what is the setting to ensure long lines of text don't disappear off the edge of the text area with '...'? – David Smithson May 15 '14 at 09:58
  • I don't seem to be having that problem.. what version of ext are you using? Check an example here: https://fiddle.sencha.com/#fiddle/5s4 – Filipe Pereira May 15 '14 at 10:32
  • 1
    I've found a workaround in http://stackoverflow.com/questions/2106104/word-wrap-grid-cells-in-ext-js, which wraps the text – David Smithson May 15 '14 at 10:37