ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: Hidehiro Ishii on November 30, 2017, 07:16:04 am
-
Hi Team,
I use PQ Grid Pro 4.0.2 with WordPress 4.9.1 & Advanced Custom Fields Pro 5.6.6.
When I Select dataType "html" or "string" or "stringi", a redundant <br> is added automatically.
So a blank line of unwanted is displayed on grid.
Please let me know how to reject a redundant <br>.
Regards,
Koichi
-
<br> are added automatically when there are line breaks ( \n, \r, \r\n\ ) in the cells.
Do you have line breaks in the cells?
If there are line breaks at end of text and you don't need them, then you can remove them by trimming the text with $.trim() either before displaying or in the column.render callback.
-
Hi Team,
Thank you for your answer.
I understand that the $.trim() is useful to reject line breaks with a single line text.
But I want to display a multi line text as follows.
This is a sample text line1 <br>
This is a sample text line2 <br>
This is a sample text line3 <br>
On this case, The $.trim() can not reject all line breaks.
Please let me know how to solve on this case
Regards,
Koichi
-
<br> are not reduntant, they are means to display new lines in html.
As per my understanding, you don't need new lines or simply want to ignore them.
you want to display this
This is a sample text line1
This is a sample text line2
This is a sample text line3
as
This is a sample text line1 This is a sample text line2 This is a sample text line3
In that case you would need to override internal function of pqgrid by adding this to your code.
pq.newLine = function(dataCell){
return dataCell;
}
-
Hi Team,
Thank you for your reply.
But the answer is different from what I want.
I want to display a multiline string without blank line with PQGrid.
I will show a example as follows.
$string="
This is a sample text line1 <br>
This is a sample text line2 <br>
This is a sample text line3 <br>
"
Normal HTML shows $string as follows.
--------------------------------------------------
This is a sample text line1
This is a sample text line2
This is a sample text line3
--------------------------------------------------
But PQGrid shows $string as follows
--------------------------------------------------
This is a sample text line1
<- blank line
This is a sample text line2
<- blank line
This is a sample text line3
--------------------------------------------------
Please let me know how to display $string as normal HTML with PQGrid.
Regards,
Koichi
-
Please share a jsfiddle so that I can check the issue faced by you.
-
Hi Team,
Thank you for your reply。
I have never used jsfiddle.
So I will study to use jsfiddle and make sample code.
Please wait a few days.
Regards,
Koichi
-
Hi Team,
I have found out to solve my problem.
I should use strip_tags() instead of $.trim().
Please close this case.
Thank your cooperation.
Best Regards,
Koichi