Line breaks, paragraphs, etc. in table cells?
Line breaks, paragraphs, etc. in table cells?
Firstly thanks - I'm completely loving this plugin and am using it for a couple of server side tables.
One of these though, I'd like to have an large-ish image with some text below in the table cell. You'd normally do this with:
[code]
Here's some text.
[/code]
Or
[code]
Here's some text.
[/code]
However, returning br or p tags in the server side function seems to break the table redraw.
Searching this forum I found another thread where someone was advised to remove all \n \r
, etc. from their server side return.
Just curious as to why this is? Is there intentionally no support for this in cells or is it something we could work on (I'm happy to have a poke around in the code and try and product a patch if required)?
If this is not supported, perhaps I can have my server side function embed a dummy attribute in the img tag and then have a post-processing piece of Javascript go though the cells later, pulling these attributes out and placing them below the image.
Any thoughts?
Thanks again,
Rob
One of these though, I'd like to have an large-ish image with some text below in the table cell. You'd normally do this with:
[code]
Here's some text.
[/code]
Or
[code]
Here's some text.
[/code]
However, returning br or p tags in the server side function seems to break the table redraw.
Searching this forum I found another thread where someone was advised to remove all \n \r
, etc. from their server side return.
Just curious as to why this is? Is there intentionally no support for this in cells or is it something we could work on (I'm happy to have a poke around in the code and try and product a patch if required)?
If this is not supported, perhaps I can have my server side function embed a dummy attribute in the img tag and then have a post-processing piece of Javascript go though the cells later, pulling these attributes out and placing them below the image.
Any thoughts?
Thanks again,
Rob
This discussion has been closed.
Replies
I ran into this problem last week and found that if any of your code should return any ' or / then it seemed to fail. the way i solved this was to force my server side script to output \' and \/ which i believe are the javascript escape versions. but this worked for me.
Regards,
Izzy
tags are acceptable.
The issue that you are facing is that Javascript has really poor support for multi-line variables. For example:
[code]
var allan = "this is
my name";
[/code]
is invalid, but if you put a "\" at the end of the first line it would work. So the problem you are encountering is that the JSON string returned from the server cannot have newline characters in them (unless properly escaped) otherwise that JSON parsing will fail.
What I really which Javascript had, was something like Perl's heredoc syntax :-)
Hope this helps,
Allan
teacher name 1 - class name - date of class
teacher name 1 - class name - date of class
teacher name 1 - class name - date of class
teacher name 2 - class name - date of class
teacher name 2 - class name - date of class
and so on. I would like there to be a blank row put in between the different teachers 1 and 2 (and 3, etc). I tried a few things but have been unsuccessful so far.
Sorry if that didnt make sense! Datatables really is a great product, and I've been amazed at how much I have been able to do with so little code!
Thanks, Dave
If client-side you could do something like this: http://datatables.net/examples/advanced_init/row_grouping.html . If server-side, then you could just insert a blank set of TR / TD elements where needed by parsing through the result set.
Allan
Allan