Multiline text in table cell (custom page)

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Multiline text in table cell (custom page)

Post by sacgtdev » 2021-04-16 06:33

I have one question on the multiline display:

The paragraph inserted into the text area showed quite well in the table cell in multiline format.

However, in the DB, it is actually preserved in string without line.

How to display it in multiline form in the custom page? I have been trying to add css for the custom page as follow, but it didn't work out:
###
.multiline {
white-space: pre-wrap;
}

<div class="multiline">
A multiline text
for demo purpose
</div>

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Multiline text in table cell (custom page)

Post by onoehring » 2021-04-16 11:00

Hi,

could you post some screenshots? And: How do you know how the string is saved in the database? If you displayed the DB contents in the browser there is already interference (as the browser takes some form of representation of that string).

Olaf

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: Multiline text in table cell (custom page)

Post by sacgtdev » 2021-04-17 06:21

The representation of the content in table cell:

1) text-area

line 1
line 2
line 3
line 4

2) DB

line 1
line 2
line 3
line 4

3) Save CSV
line 1 line 2 line 3 line 4

4) In custom page
line 1 line 2 line 3 line 4

How to make the representation of text in multiline format as shown in (1) and (2) for (3) and (4)?

Regards,
Stephen

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Multiline text in table cell (custom page)

Post by onoehring » 2021-04-17 06:49

Hi Stephen,

just a try: Maybe take a look at the nl2br function of PHP and run the data through this before using it in a custom page. CSV ... let's do this once your custom page works. See:
https://www.php.net/manual/en/function.nl2br.php
https://www.w3schools.com/PHP/func_string_nl2br.asp

Olaf

sacgtdev
Veteran Member
Posts: 75
Joined: 2020-06-10 11:14

Re: Multiline text in table cell (custom page)

Post by sacgtdev » 2021-04-18 03:52

Dear Olaf,

That will work only when the text have \n to indicate where to break the line.
However, the existing text do not have \n.

I wonder how the original table cell could show the representation of text with line-break.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Multiline text in table cell (custom page)

Post by onoehring » 2021-04-18 06:59

Hi,
I would suggest looking at your data with MySQL Workbench or some other tool which does not include the browser. If there are linebreaks somewhere, they must obviously be saved with the data.

Olaf

Post Reply