New lines are available in Multi-line and HTML editor types. If you're simply pulling values from the database, you will need to have line breaks in the database entry for wpDataTables to be able to recognize them.
I tried everything to get a line break. Tried \r, \n, CHAR(10). As mentioned earlier, it works when I paste the result in a notepad entry, but the line break is ignored in the table cell.
Unfortunately, the PHP SQL parser we use can't do everything phpMyAdmin and other tools do.
If it works in phpMyAdmin, you can create a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
The plugin cannot see the new lines because of the parser it uses, and therefore it can't be included like that. Try with the view, and I'll see with our developers if there's another way to include line breaks.
I just worked out a solution. It might be worth adding to your documentation.
I put HTML codes in the field and the table picked them up!
For example, the line below ensure that the data is indented after the collapsable '+' symbol and it makes the first line bold. In the below, replace [ampersand] with an ampersand. This post removes them if I just copy paste them here.
SELECT CONCAT_WS( '<br> [ampersand]nbsp; [ampersand]nbsp;[ampersand]nbsp;[ampersand]nbsp;[ampersand]nbsp; ', CONCAT('<b>',`CaseTitleLong`,'</b>'), `CaseNo`, `CourtName`, CONCAT(CONVERT(DATE_FORMAT(`CaseDate`, "%a %d %b %Y"),CHAR),' at ',CONVERT(TIME_FORMAT(`TimeSlot`,"%h:%i %p"),CHAR)) ) AS `Case`
Hi,
I am trying to format text in the datatable with returns of line feeds but wpDataTables is ignoring them. How can this be done.
For example, I want this
A, A.(SUPPRESSED)
189 MCPAR-20-XXXXX
XXXXX Magistrates' Court
Fri XX Dec 2020 at 10:00 AM
15 Frobisher Road, Elizabeth
But I get this
A, A.(SUPPRESSED) 189 MCPAR-20-11364 Elizabeth Magistrates' Court Fri 11 Dec 2020 at 10:00 AM 15 Frobisher Road, Elizabeth
The MySQL works fine when I copy to Notepad
SELECT
CONCAT_WS(
CHAR(13),
`PartName`,
`CaseNo`,
`CourtName`,
CONCAT(CONVERT(DATE_FORMAT(`CaseDate`, "%a %d %b %Y"),CHAR),' at ',CONVERT(TIME_FORMAT(`TimeSlot`,"%h:%i %p"),CHAR))
) AS `Case`
I also tried ' ' as well but this does not work.
Also, is it possible to have the top line bold and the others below not?
For example
A, A.(SUPPRESSED)
189 MCPAR-20-XXXXX
XXXXX Magistrates' Court
Fri XX Dec 2020 at 10:00 AM
15 Frobisher Road, Elizabeth
Hello Shon
Thank you for your purchase.
New lines are available in Multi-line and HTML editor types. If you're simply pulling values from the database, you will need to have line breaks in the database entry for wpDataTables to be able to recognize them.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi,
I tried everything to get a line break. Tried \r, \n, CHAR(10). As mentioned earlier, it works when I paste the result in a notepad entry, but the line break is ignored in the table cell.
Hello again Shon
Unfortunately, the PHP SQL parser we use can't do everything phpMyAdmin and other tools do.
If it works in phpMyAdmin, you can create a MySQL view (a stored query), which will return the data that you need, call it e.g. “view1” and then build a wpDataTabled based on a simple query like “SELECT * FROM view1″.
The plugin cannot see the new lines because of the parser it uses, and therefore it can't be included like that. Try with the view, and I'll see with our developers if there's another way to include line breaks.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hi Aleksandar,
I just worked out a solution. It might be worth adding to your documentation.
I put HTML codes in the field and the table picked them up!
For example, the line below ensure that the data is indented after the collapsable '+' symbol and it makes the first line bold. In the below, replace [ampersand] with an ampersand. This post removes them if I just copy paste them here.
SELECT
CONCAT_WS(
'<br> [ampersand]nbsp; [ampersand]nbsp;[ampersand]nbsp;[ampersand]nbsp;[ampersand]nbsp; ',
CONCAT('<b>',`CaseTitleLong`,'</b>'),
`CaseNo`,
`CourtName`,
CONCAT(CONVERT(DATE_FORMAT(`CaseDate`, "%a %d %b %Y"),CHAR),' at ',CONVERT(TIME_FORMAT(`TimeSlot`,"%h:%i %p"),CHAR))
) AS `Case`
Works beautifully now!
Thanks for sharing that, Shon, I'm sure it will come in handy for others!
I'll forward it to our developers, and I hope it will be added to the FAQ section.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables