问题
I am customizing the description field on the Project Quotes form (Screen PM304500). I need the description field to be multi-line and it must preserve new lines.
I have customized the field itself to allow for very long strings and I have customized the corresponding PXGridColumn with Multiline="true". With this I am able to edit the field value and with shift-enter I am able to insert newlines in the string. Also, the grid column, when not editing, will display the string on multiple lines, but new lines are ignored as if the value is being displayed as HTML. I know the newlines are preserved since, when I again edit the value, the newlines are present.
Further, I have been able to use the developer console in Chrome to drill down to the that results from the PXGridColumn. That is styled with "white-space: normal". If I change this to "white-space: pre-wrap" the column looks as I want it to.
I have also tried munging the value of the field to replace the newlines with
tags. Unfortunately, when I do this, I see the literal "
" in the value rather than a new line.
Ideally, I would like to just change the styling on the elements that result from the PXGridColumn to "white-space: pre-wrap". Is there an attribute/property for PXGridColumn that will allow me to do that? Alternatively, I would be okay with the replacing new lines with
approach if I could get the value to render as HTML. Of course, I am open to other approaches.
回答1:
You can achieve this in the following way:
- Copy the Default folder in the App_Themes folder of Acumatica:
Open 00_Controls.css file in the copied folder and the css class below to the end of the file and save the file
.MyTable table:not([class~=GridRowForm]) tbody tr td{ white-space: pre-wrap !important; }
In the Screen Editor select the Grid you want to have that white-space css style applied and add MyTable as CssStyle.
Now go to Site Preferences(SM200505) page and select Default - Copy as Interface Theme
After these steps, you should be able to get the following UI in Sales Orders Details:
来源:https://stackoverflow.com/questions/56452489/how-can-i-make-an-acumatica-multiline-pxgridcolumn-display-new-lines