$(document).ready(function () { $("#empTable").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 "ajax": { "url": "/Home/GetData", "type": "POST", "datatype": "json" }, "columnDefs": [{ "targets": [0], "visible": false, "searchable": false }], "columns": [ { "data": "EmployeeID","autoWidth": true }, { "data": "FirstName", "autoWidth": true }, { "data": "LastName", "autoWidth": true }, { "data": "Education", "autoWidth": true }, { "data": "City", "autoWidth": true }, { "render": function (data, type, row, meta) { return 'Edit'; } }, { data: null, render: function (data, type, row) { return "Delete"; } }, ] }) }); function DeleteData(EmployeeID) { if (confirm("Are you sure you want to delete ...?")) { Delete(EmployeeID); } else { return false; } } function Delete(EmployeeID) { var url = '@Url.Content("~/")' + "Home/Delete"; $.post(url, { ID: EmployeeID }, function (data) { if (data) { oTable = $('#empTable').DataTable(); oTable.draw(); } else { alert("Something Went Wrong!"); } }); }
@shifamalik30214 жыл бұрын
Keep it up!
@joydeepsingh16814 жыл бұрын
Nicely explained!
@SukhrajMohammad4 жыл бұрын
Glad it was helpful!
@RememberRund Жыл бұрын
How we should add multiple functions of filter and search
@masumehoseini8370 Жыл бұрын
hi, thankyou for video but where is the next session? because your result id different from table in start of video
@SukhrajMohammad Жыл бұрын
Next session was not uploaded but you can find the code in pinned comment
@saurabhsingh-f2m Жыл бұрын
why are you using [HttepPost] verb for getting the data from database?
@SukhrajMohammad Жыл бұрын
Because mine C# code function is with httpPost , you can try with Get,it will work...
@kumarchandan0194 жыл бұрын
I m trying to find the same which explains jQuery table
@codingislife63872 жыл бұрын
2:02 GetAllEmployee() ===> unable to understand
@SukhrajMohammad2 жыл бұрын
GetAllEmployees is function/method written in C# code to get list of Employees from database, It is returning List and then I am converting this collection to json format and returning back to jQuery Datatable
@charlesmcclellan82122 жыл бұрын
@@SukhrajMohammad I am new and trying to understand this as well. How does the function in the Home Controller access the GetAllEmployee list? This is at 13 minutes and 14 seconds on line 31 of the HomeController
@SukhrajMohammad2 жыл бұрын
GetAllEmployee() is private method inside the controller which is returning the list of Employees. For demo purpose I have created this method inside the controller otherwise we should have this method in service class and using service class instance should call in Controller.
@bkcy18 Жыл бұрын
Is there a server side implementation for this? I've a table with huge amount of data that is growing every year. Fetching all the records at once is out of the question.
@SukhrajMohammad Жыл бұрын
Yes, we can use pagination with server side logic, where we will use logic to get data for current page only,but in that case sorting and search also post back to server to get data..
@mohammadrezakazemiesfeh2294 Жыл бұрын
Thanks
@AmirKhan-sh7tb4 жыл бұрын
Nyc
@khoantum2 жыл бұрын
Do you have sample project & code available so we don't have to write it all out to test this method?