Is it possible to use Ignited Datatables with Editor?

Is it possible to use Ignited Datatables with Editor?

pansengtatpansengtat Posts: 66Questions: 26Answers: 1
edited October 2014 in Editor

There was a question similar to what I am writing here at the CodeIgniter forums, about Ignited Datatables and whether if it is possible to combine the use of this Datatable wrapper with Datatables Editor (see thread at: https://ellislab.com/forums/viewthread/160896/P435/). Currently, I require the use of aggregate functions like SUM(), DATE_FORMAT(column, "%Y-%m-%d"), as well as GROUP BY and LIKE on MySQL tables as well as editing each entry (last time I checked on Editor, I couldn't find those special functions used in MySQL in Editor, only left joins and where). Ignited Datatables can be found at (https://github.com/n1crack/IgnitedDatatables-php-library)

Here is a sample of what I wrote using Ignited Datatables:

test_ajax.php
```php
<?php
require_once('IgnitedDatatables.php');
$datatables = new Datatables('mysqli');

$config = array(
'username' => 'whatever_username',
'password' => 'whatever_password',
'database' => 'yourDatabase',
'hostname' => 'localhost');

$datatables->connect($config);

$datatables
->select('DATE_FORMAT(RequestMain.RequestDateTime, "%Y-%m-%d") as trDate')
->select('ProjectMain.Name as prjName')
->select('Orders.Ordernumber as orderNum')
->select('Group.Name as grpName')
->select('CenterMirror.Name as centerName')
->select('RegionMirror.Name as regName')
->select('RequestMain.TestTitle as trTitle')
->select('Orders.TotalMandayReq as TotalMandayReq, Orders.TotalMandayReq * Orders.CostRate as totalCostAppr')
->select('(SUM(Schedule.ManHrsNM) + SUM(Schedule.ManHrsOT) + SUM(Schedule.ManHrsOTSunPH))/8 as totalMandayUsed, (SUM(Schedule.ManHrsNM) + SUM(Schedule.ManHrsOT) + SUM(Schedule.ManHrsOTSunPH))/8 * Orders.CostRate as totalCostPaid, (Orders.TotalMandayReq * Orders.CostRate) - ((SUM(Schedule.ManHrsNM) + SUM(Schedule.ManHrsOT) + SUM(Schedule.ManHrsOTSunPH))/8 * Orders.CostRate) as totalCostBalance')
->select('Orders.QuoteNum as quoNum')
->select('StatusMirror.String as orderStatus')
->select('Orders.DateStart as DateStart, Orders.DateEnd as DateEnd, Orders.DateClosed as DateClosed, Orders.Remarks as Remarks,Orders.CostRate as CostRate,Orders.ProjectID as prjID')
->from('Orders')
->join('ProjectMain', 'Orders.ProjectID = ProjectMain.ID', 'left')
->join('RequestMain', 'Orders.POnumber = RequestMain.POpoNumber', 'left')
->join('Schedule', 'RequestMain.TestRequestNo = Schedule.TestRequestNo', 'left')
->join('Group', 'Orders.GroupID = Group.ID', 'left')
->join('CenterMirror', 'Orders.CenterID = CenterMirror.ID', 'left')
->join('RegionMirror', 'Orders.RegionID = RegionMirror.ID', 'left')
->join('StatusMirror', 'Orders.StatusID = StatusMirror.ID', 'left');

echo $datatables->generate();

<?php > ``` ?>

If my instance of a dataTable() is initialized this way, how do I apply Editor on both JS and PHP for this particular dataTable() instance?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Hi,

    If you didn't want to (or can't because it doesn't provide the full set of features you need) use the Editor PHP libraries, you would need to implement the Create, Update and Delete actions - much as you have done the Read action above.

    The client / server communication protocol Editor uses is documented in the manual and will provide the information needed to implement that code.

    Allan

This discussion has been closed.