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
Ashish Pandey
1.4k
351
8k
search and sorting not working
Oct 17 2018 4:58 AM
<script type="text/javascript">
var $= jQuery.noConflict();
$(document).ready(function () {
GetcountryDetails();
$('#myDatatable').DataTable({
order: [[0, 'asc']],//default,
aLengthMenu: [[10, 25, 50, 100, 500, -1], [10, 25, 50, 100, 500, "All"]],
columnDefs: [
{ "width": "50px", "targets": 0 },
{ "width": "100px", "targets": 1 },
{ "width": "200px", "targets": 2 },
{ "width": "150px", "targets": 3 },
{ "width": "110px", "targets": 4 },
],
});
});
function GetcountryDetails() {
debugger;
url: '@Url.Action("Getcountry", "Master")',
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: '{}',
cache: false,
success: function (data) {
result = (data);
if (result.length > 0) {
// to remove old record
$('#myDatatable tbody tr').remove();
for (var i = 0; i < result.length; i++) {
tr = "<tr>";
tr += "<td>" + (i + 1) + "</td>";
tr += "<td>" + result[i].CountryName + "</td>";
tr += "<td>" + result[i].VCountryCode + "</td>";
tr += "<td>" + result[i].TimeZoneText + "</td>";
tr += "<td><button class='btn btn-primary' onclick='Edit(" + result[i].CountryCode + ");'><i class='glyphicon glyphicon-edit'></i> Edit</button>";
tr += " <button class='btn btn-danger' onclick='Delete(" + result[i].CountryCode + ");'><i class='glyphicon glyphicon-trash'></i> Delete</button></td></tr>";
$('#myDatatable tbody').append(tr);
}
}
},
failure: function (data) {
alert('Failure!');
},
error: function (data) {
alert('Error!');
}
});
};
</script>
[HttpPost]
public JsonResult Getcountry(VM_M_Country_Details VM_M_Country_Details)
{
//OBJ_VM_M_Country_Details = new VM_M_Country_Details();
// OBJ_VM_M_Country_Details.CountryCode = 0;
OBJ_M_Country_DAL = new M_Country_DAL();
var countrylist = OBJ_M_Country_DAL.GetcountryList();
return Json(countrylist, JsonRequestBehavior.AllowGet);
}
Reply
Answers (
1
)
How to pass values ?
Showing 0 to 0 of 0 entries