TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramco Ramco
440
3.4k
527.6k
JQuery Datatable
May 29 2021 4:10 PM
Hi
I have below DataTable . I want to use Sorting,Pagelength like settings Centralised thru Class so that it can be used on all DataTables, With the below code i have to write it on every Index.
$(document).ready(
function
() {
$(
"#tblLocation"
).dataTable({
ajax: {
type:
"get"
,
url:
"/Location/List"
,
dataType:
"json"
,
dataSrc:
""
},
paging:
true
,
sort:
true
,
pageLength: 10,
searching:
true
,
columns: [
{
'data'
:
'Id'
},
{
'data'
:
'Description'
},
{
'data'
:
'IsActive'
},
{
"defaultContent"
:
'<button id="btnEdit" type="submit"><i class="fa fa-pencil"></i></button>'
}
// <td><p data-placement="top" data-toggle="tooltip" title="Edit"><button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal" data-target="#edit" ><span class="glyphicon glyphicon-pencil"></span></button></p></td>
//<td><p data-placement="top" data-toggle="tooltip" title="Delete"><button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal" data-target="#delete" ><span class="glyphicon glyphicon-trash"></span></button></p></td>
]
});
$(
'body'
).on(
'click'
,
'[id*=btnEdit]'
,
function
() {
var
data = $(
this
).parents(
'tr'
).find(
'td'
);
var
id = data.eq(0).html();
var
description = data.eq(1).html();
$(
'[id*=txtId]'
).val(id);
$(
'[id*=txtDescription]'
).val(description);
$(
"#btnAdd"
).hide();
$(
".modal-title"
).html(
"Update"
);
$(
"#btnUpdate"
).show();
$(
'#myModal'
).modal(
"show"
);
});
});
Thanks
Reply
Answers (
4
)
View & Delete in DataTable
500 (Internal Server Error) while uploading the more than 7MB image