DataTableServerSide.AspNetCore 1.0.0

There is a newer version of this package available.
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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DataTableServerSide.AspNetCore" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DataTableServerSide.AspNetCore --version 1.0.0
#r "nuget: DataTableServerSide.AspNetCore, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

  1. Kurulum
  • NuGet üzerinden kütüphaneyi projenize ekleyin.

    dotnet add package DataTableServerSide.AspNetCore
    
  1. 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; }
    }
    
  1. 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;
        }
    }
    
  2. İ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" }
            ]
        });
    
  3. Ö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.
  4. Kendi Filtreleme ve Sıralama Mantığı

    Kütüphane, verileri filtreleme ve sıralama için özelleştirmenize olanak tanır. ApplyFilters ve ApplySorting 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 102 2/5/2024
1.0.0 75 2/2/2024

This library is designed to facilitate server-side table operations using the DataTables plugin in your ASP.NET Core projects.