0

Anyone can help how to put HTML   tag in Javascript code below? My plan is to have a space after word "entries".

enter image description here

Below are the Javascript code.

$('document').ready(function(){
$('.data-table-export').DataTable({
 scrollCollapse: true,
 autoWidth: false,
 responsive: true,
 columnDefs: [{
 targets: "datatable-nosort",
 orderable: false,
 }],
 "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
 "language": {
 "info": "_START_-_END_ of _TOTAL_ entries",
 searchPlaceholder: "Search"
 },
 dom: 'Bfltip',
 buttons: [
 'copy', 'csv', 'pdf', 'print'
 ]
 });
});
asked May 15, 2019 at 0:42
2
  • This may because the outer div (or some element) does not have enough width. Try adding style="width:100%" to outer element Commented May 15, 2019 at 1:25
  • Ideally you should keep your text string immutated, and apply visual spacing through the use of css. The best way to do it would be to add some margin-left to the button-group next to your string. What's the class of the button-group with "copy, csv, pdf, print"? Commented May 15, 2019 at 1:30

2 Answers 2

1

You might be better off using CSS:

.data-table-export select {
 margin-right: 10px;
}

This won't achieve exactly what you're after, as I do not know the HTML structure returned by .DataTable, but you could certainly adapt it to your needs!

Since the question has a js tag, you could do $('.data-table-export X').css('marginLeft', '10px') where X is the selector for the first button.

answered May 15, 2019 at 0:44
Sign up to request clarification or add additional context in comments.

3 Comments

I think you might mean .data-table-export {margin-left:10px} ... ?
@gibberish if it were something like button:first-of-type, then sure! And yes, first stab was very invalid CSS, oops!
I agree - spacing should be done with css not with adding non-breaking spaces to the html
0

Change from

"info": "_START_-_END_ of _TOTAL_ entries"

to

"info": "_START_-_END_ of _TOTAL_ entries "

Or update info section CSS

.dataTables_info{
 padding-right:5px;
}
answered May 15, 2019 at 0:52

3 Comments

Just apply and nothing change.
did you try "info": "START-END of TOTAL entries  " ?
already answered above for your both solutions but nothing changes happen :-)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.