Asked by:
Uncaught SyntaxError: Unexpected end of input

Question
-
User-1499457942 posted
Hi
On Below code i am getting above error
$(document).ready(function () { $("#gvw").prepend($("<thead><tr><th colspan='12'></th><th colspan='6'>Sale</th><th colspan='6'>Purchase</th></tr></thead>").append($(this).find("tr:first"))).dataTable() ({ "pageLength": 10 });
Thanks
Monday, December 3, 2018 10:51 AM
All replies
-
User-893317190 posted
Hi JagjitSingh,
You have missed a "})" in your js.
$(document).ready(function () { $("[id*=gvw]").prepend($("<thead><tr><th colspan='12'></th><th colspan='6'>Sale</th><th colspan='6'>Purchase</th></tr></thead>").append($(this).find("tr:first"))).dataTable() ({ "pageLength": 10 }) }) ;
Best regards,
Ackerly Xu
Tuesday, December 4, 2018 1:55 AM -
User-1499457942 posted
Hi Ackerly.
Thanks . But 1 issue i am facing project hangs after this screen . I am not able to click on anything in Menu.
Someone or u may have provided this solution also that Syntax for Jquery Datatable is wrong in the above code.
Below code is working but problem is . It print 1 row above and 1 row below to the existing Header row. I want above only.
$(document).ready(function () { $("[id*=gvw]").prepend($("<thead></thead>").html($("[id*=gvw]").find("tr:first"))).dataTable({ "pageLength": 10 }) $("[id*=gvw]").find("thead").prepend("<tr ><th colspan='12' style='text-align:center'>column</th></tr>") });
Thanks
Tuesday, December 4, 2018 4:58 AM -
User-893317190 posted
Hi JagjitSingh,
If you want to remove the second header row,you could use the code below.
$(function () { $("[id*=gvw]").prepend($("<thead></thead>").html($("[id*=gvw]").find("tr:first"))).dataTable({ "pageLength": 10 }) $("[id*=gvw]").find("thead").prepend("<tr ><th colspan='3' style='text-align:center'>column</th></tr>") //if you want to add another column in the header $("[id*=gvw] thead tr:last").remove(); })
Best regards,
Ackerly Xu
Tuesday, December 4, 2018 5:19 AM -
User-1499457942 posted
Hi
Thanks . But why in the below code System hangs
$(document).ready(function () { $("[id*=gvw]").prepend($("<thead><tr><th colspan='12'></th><th colspan='6'>Sale</th><th colspan='6'>Purchase</th></tr></thead>").append($(this).find("tr:first"))).dataTable() ({ "pageLength": 10 }) }) ;
ThanksTuesday, December 4, 2018 5:25 AM -
User-1499457942 posted
Hi Ackerly
How to set background , forecolor of first Header row
Thans
Tuesday, December 4, 2018 6:01 AM -
User-893317190 posted
Hi JagjitSingh,
Just set the background-color property and color property to the first tr.
$("[id*=gvw]").find("thead").prepend("<tr style='background-color:red;color:white' ><th colspan='3' style='text-align:center;'>column</th></tr>")
Best regards,
Ackerly Xu
Tuesday, December 4, 2018 6:11 AM -
User-1499457942 posted
Hi Ackerly
I have below code but it is not changing color
$(document).ready(function () {
$("[id*=gvw]").prepend($("<thead></thead>").html($("[id*=gvw]").find("tr:first"))).dataTable({ "pageLength": 10 })
$("[id*=gvw]").find("thead").prepend("<tr ><th colspan='6' style='text-align:center;color:white,background-color:#428bca'></th><th colspan='6'>Sale</th><th colspan='6'>Purchase</th><th colspan='6'></th></tr>")});
Thanks
Tuesday, December 4, 2018 6:54 AM -
User-893317190 posted
Hi JagjitSingh,
If you want to change the whole row, you should add style to tr instead of th. And you should change the comma to semicolon.
<tr style='text-align:center;color:white;background-color:red'><th colspan='6' ></th><th colspan='6'>Sale</th><th colspan='6'>Purchase</th><th colspan='6'></th></tr>
Best regards,
Ackerly Xu
Wednesday, December 5, 2018 1:22 AM