DataTableServerSide.AspNetCore
1.0.0
See the version list below for details.
dotnet add package DataTableServerSide.AspNetCore --version 1.0.0
NuGet\Install-Package DataTableServerSide.AspNetCore -Version 1.0.0
<PackageReference Include="DataTableServerSide.AspNetCore" Version="1.0.0" />
paket add DataTableServerSide.AspNetCore --version 1.0.0
#r "nuget: DataTableServerSide.AspNetCore, 1.0.0"
// Install DataTableServerSide.AspNetCore as a Cake Addin
#addin nuget:?package=DataTableServerSide.AspNetCore&version=1.0.0
// Install DataTableServerSide.AspNetCore as a Cake Tool
#tool nuget:?package=DataTableServerSide.AspNetCore&version=1.0.0
DataTableServerSide.AspNetCore
Bu kütüphane, ASP.NET Core projelerinizde DataTables eklentisini kullanarak sunucu taraflı tablo işlemlerini kolaylaştırmak için tasarlanmıştır.
Nasıl Kullanılır
- Kurulum
NuGet üzerinden kütüphaneyi projenize ekleyin.
dotnet add package DataTableServerSide.AspNetCore
- Model oluşturma
Model sınıfınızı oluşturun.
public class PersonModel { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Phone { get; set; } public string Mail { get; set; } public string Address { get; set; } public int Age { get; set; } }
Controller'da Kullanım
using Bogus; using DataTableServerSide.AspNetCore; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; public class HomeController : Controller { public IActionResult Index() { return View(); } [HttpPost] public JsonResult GetPersons() { var personList = Persons(); var dataTableHelper = new DataTableHelper<YourModel>(data, Request); var result = dataTableHelper.GetDataTableResult(); return Json(result); } public List<PersonModel> Persons() { List<PersonModel> persons = new(); var faker = new Faker(); for (int i = 0; i < 10000; i++) { PersonModel person = new() { Id = i + 1, FirstName = faker.Name.FirstName(), LastName = faker.Name.LastName(), Phone = faker.Phone.PhoneNumberFormat(), Mail = faker.Internet.Email(), Address = faker.Address.FullAddress(), Age = faker.Random.Number(18, 80) }; persons.Add(person); } return persons; } }
İstemci tarafında DataTable Ayarları
HTML sayfanızda DataTable'ı aşağıdaki gibi yapılandırın:
<div class="mb-5 mt-5"> <h2>Person Lists</h2> <hr /> <table id="myTable" class="table"> <thead> <tr> <th scope="col">#</th> <th scope="col">FirstName</th> <th scope="col">LastName</th> <th scope="col">Phone</th> <th scope="col">Email</th> <th scope="col">Address</th> <th scope="col">Age</th> </tr> </thead> </table> </div>
JavaScript ile DataTable'ı yapılandırın:
$(document).ready(function () { $(document).ready(function () { var table = $('#myTable').dataTable({ lengthMenu: [[10, 25, 50, 100], [10, 25, 50, 100]], pageLength: 10, processing: true, serverSide: true, filter: true, ordering: true, ajax: { url: "/Home/GetPersons", type: "POST", datatype: "json" }, columns: [ { data: "id", name: "id" }, { data: "firstName", name: "firstName" }, { data: "lastName", name: "lastName" }, { data: "phone", name: "phone" }, { data: "mail", name: "mail" }, { data: "address", name: "address" }, { data: "age", name: "age" } ] });
Örnek Kullanım
PersonModel
sınıfınıza uygun bir model oluşturun.- Controller'daki
GetDataTable
yöntemine uygun veriyi sağlayın. - DataTable'ı ilgili HTML sayfanıza entegre edin ve JavaScript ile yapılandırın.
Kendi Filtreleme ve Sıralama Mantığı
Kütüphane, verileri filtreleme ve sıralama için özelleştirmenize olanak tanır.
ApplyFilters
veApplySorting
yöntemlerini düzenleyerek kendi mantığınızı ekleyebilirsiniz.
Katkıda Bulunma
Eğer bir sorun bulursanız veya katkıda bulunmak istiyorsanız, lütfen bir sorun açın veya bir pull talebi gönderin.
Proje Demosu
Proje Demosu'nu inceleyebilirsiniz
Lisans
Bu proje MIT lisansı altında lisanslanmıştır. Detaylı bilgi için lisans dosyasını inceleyebilirsiniz.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
This library is designed to facilitate server-side table operations using the DataTables plugin in your ASP.NET Core projects.