Git Product home page Git Product logo

codeigniter4-datatables's Introduction

CodeIgniter4 DataTables Library

Donate Total Downloads GitHub repo size GitHub

Server-side Datatables library for CodeIgniter4 PHP framework CodeIgniter4-DataTables is CodeIgniter4 Library to handle server-side processing of DataTables jQuery Plugin via AJAX option by using Query Builder CodeIgniter 4

Documentation

For more complete example and demo please visit Documentation here

Requirements

  • Codeigniter 4.x
  • jQuery DataTables v1.10.x

Installing

Using composer

Use composer to install CodeIgniter4-DataTables into your project :

composer require hermawan/codeigniter4-datatables

Simple Initializing

Using CodeIgniter Query Builder

This is simple basic code just write DataTable::of($builder) call method toJson() for output

$builder is CodeIgniter build-in Query Builder object.

Controller :

use \Hermawan\DataTables\DataTable;

public function ajaxDatatable()
{
    $db = db_connect();
    $builder = $db->table('customers')->select('customerNumber, customerName, phone, city, country, postalCode');

    return DataTable::of($builder)->toJson();
}

Using CodeIgniter Model

You can initialize using Model instead Query Builder This is simple example basic code

Controller :

use \Hermawan\DataTables\DataTable;
use \App\Models\CustomerModel;

public function ajaxDatatable()
{
    $customerModel = new CustomerModel();
    $customerModel->select('customerNumber, customerName, phone, city, country, postalCode');

    return DataTable::of($customerModel)->toJson();
}

Javascript :

$(document).ready(function() {
    $('#table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '<?php echo site_url('customers/ajaxDatatable'); ?>'
    });
});

For more complete example and demo please visit Documentation here

codeigniter4-datatables's People

Contributors

asnanmtakim avatar erikkraijenoord avatar hermawanramadhan avatar lea-reif avatar nounours13 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.