• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataTables 1.10 > Library

#1
Smile 
I just pushed a new DataTables library that I created for a project I have been working on.  It is well documented on github.  Head on over and let me know what you think.   Big Grin

https://github.com/zepernick/Codeigniter-DataTables

Features
  • Generates Necessary JSON For Sever Side Tables
  • Handles Sorting & Column Based Searching
  • Builds the select automatically from the DataTable column names
  • Append custom SQL expressions to the generated Select statement
  • Append a static where clause
  • Formatters For Date, Percent, Currency, and Boolean
  • Utilizes CI Active Record
  • Drastically Reduces PHP Code Necessary To Generate a Server Side Table

Here is a example of the Controller.

PHP Code:
class DataTableExample extends CI_Controller {
 
   public function dataTable() {
 
       //Important to NOT load the model and let the library load it instead.  
 
       $this -> load -> library('Datatable', array('model' => 'state_dt''rowIdCol' => 'c.id'));

 
       //format array is optional, but shown here for the sake of example
 
       $json $this -> datatable -> datatableJson(
 
           array(
 
               'a_date_col' => 'date',
 
               'a_boolean_col' => 'boolean',
 
               'a_percent_col' => 'percent',
 
               'a_currency_col' => 'currency'
 
           )
 
       );

 
       $this -> output -> set_header("Pragma: no-cache");
 
       $this -> output -> set_header("Cache-Control: no-store, no-cache");
 
       $this -> output -> set_content_type('application/json') -> set_output(json_encode($json));

 
   }


Reply

#2
Very nice done, thx for sharing to the community!
Can you provide a working online example? That's what most user want to check before they use a library ^^.

Reply

#3
Sure, not a problem. I will get a working example together this weekend and update this thread. Thanks!
Reply

#4
As promised, here is a full working example using CI 3. The library has been primarily run on CI 2, but thought I would use this as an excuse to check out CI 3. There is a download link on the top right of the menu which will download the entire example application.

I must say that the DB Queries seem much quicker. That was the first thing I noticed. Great job guys, and I look forward to the upcoming release!
Reply

#5
Thank you for the working demo. As i noticed the datatable is produced by ajax. Would it be possible to build the table also as html (that is what i do normaly on my templates because seo for google).

Reply

#6
The library is only doing the backend JSON for DataTables. It will not write pure table HTML. What are you looking for the library to do with the HTML table? Paging and Sorting with no Ajax?
Reply

#7
I was looking for something like this for a few days ... Any options for CRUD functions ?
Reply

#8
https://github.com/IgnitedDatatables/Ign...atatables/

Ajax + DataTables
Reply

#9
(02-03-2015, 08:11 AM)GrigoreMihai Wrote: I was looking for something like this for a few days ... Any options for CRUD functions ?

It does not have anything built in to help with the inline editing. It handles the server side calls for the Ajax functionality of DataTables. It would be a alternative to IgnitedDataTables. DataTables has the ability to append extra columns in the JavaScript and attach events for things such as deletion. You can just use another CI Controller to do the delete and call the refresh on the table. Just as an example... Not entirely sure I know what you are wanting to do with CRUD other than have complete inline editing.
Reply

#10
is it possible to make custom column that have an action button (for edit or delete) with this library ?
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.