Click here to Skip to main content
15,899,025 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have load the multiple records from sql database table to JQuery Datatable.
I want to do that, to set focus in JQuery Datatable cell 1st row & 1st column after page load.
How will i do that???
Please help to me anybody.....

What I have tried:

$(document).ready(function () {
$("#demoGrid").DataTable({
processing: true, // for show progress bar
serverSide: true, // for process server side
filter: true, // this is for disable filter (search box)
orderMulti: false, // for disable multiple column at once
paging: false,
scrollY: 200,
keys: true,

ajax: {
url: "/Demo/LoadData",
type: "POST",
datatype: "json"
},

columnDefs:
[{
targets: [0],//companyID
visible: false,
searchable: false
},
{
targets: [2],//contactname
orderable: false
},
{
targets: [3],//contactTitle
orderable: false
},
{
targets: [4],//CIty
orderable: false
},
{
targets: [5],//PostalCode
orderable: false
},
{
targets: [6],//country
orderable: false
},
{
targets: [7],//phone
visible: false,
searchable: false,
orderable: false
},
],

columns: [
{ data: "CustomerID", name: "CustomerID", autoWidth: true },
{ data: "CompanyName", name: "CompanyName", autoWidth: true },
{ data: "ContactName", "title": "ContactName", name: "ContactName", autoWidth: true },
{ data: "ContactTitle", name: "ContactTitle", autoWidth: true },
{ data: "City", name: "City", autoWidth: true },
{ data: "PostalCode", name: "PostalCode", autoWidth: true },
{ data: "Country", name: "Country", autoWidth: true },
{ data: "Phone", name: "Phone", title: "Status", autoWidth: true},

]

});

});
Posted
Updated 15-Oct-19 1:02am

1 solution

The documentation for jquery datatable has the answer. cell().focus()[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900