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
439
3.4k
544.3k
Render in Jquery DataTable
May 31 2021 2:03 AM
Hi
How the below 2 lines works. Secondly how to call function on click of Edit
{
"render": function (data, type, full, meta)
{ return '<a class="fa fa-pencil" href="#' + full.Id + '"></span></a>'; }
},
{
data: null, render: function (data, type, row) {
return "<a href='#' class='fa fa-trash' onclick=Delete('" + row.Id + "'); ></a>";
}
},
$(document).ready(
function
() {
//loadData();
$(
"#tblLocation"
).dataTable({
ajax: {
type:
"get"
,
url:
"/Location/List"
,
dataType:
"json"
,
dataSrc:
""
},
paging:
true
,
sort:
true
,
pageLength: 10,
searching:
true
,
columns: [
{
'data'
:
'Id'
,
"autoWidth"
:
true
},
{
'data'
:
'Description'
,
"autoWidth"
:
true
},
{
'data'
:
'IsActive'
,
"autoWidth"
:
true
},
{
"render"
:
function
(data, type, full, meta)
{
return
'<a class="fa fa-pencil" href="#'
+ full.Id +
'"></span></a>'
; }
},
{
data:
null
, render:
function
(data, type, row) {
return
"<a href='#' class='fa fa-trash' onclick=Delete('"
+ row.Id +
"'); ></a>"
;
}
},
]
});
$(
'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 (
2
)
Uncaught TypeError: Cannot read property 'style' of undefined
Create HTML file .