2017 © Pedro Peláez
 

symfony-bundle datatables-form-bundle

Provides Form Types and Entities representing the DataTables AJAX Request.

image

secamedia/datatables-form-bundle

Provides Form Types and Entities representing the DataTables AJAX Request.

  • Thursday, November 9, 2017
  • by secamedia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 219 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

DataTables Form Types and Entities for AJAX Request

This is a Symfony Bundle to represent the DataTables Ajax Request Data into an entity via form types., (*1)

Installation via Composer

Install it via composer as a dependency:, (*2)

$ php composer.phar require secamedia/datatables-form-bundle, (*3)

Activation

Register the bundle in the kernel to activate the bundle., (*4)

    public function registerBundles()
    {
        $bundles = [
            ...
            new Sm\DatatablesFormBundle\SmDatatablesFormBundle(),
            ...
        ];
    }

How to use with DataTables ajax request

To recognize the request data you have to move the datatables data into the key datatables:, (*5)

$('table').DataTable({
    'ajax': {
        'url': '/ajax-request.php',
        'data': function (data) {
            // Move DataTables data into own key
            for (var d in data) {
                if (!data.hasOwnProperty(d)) {
                    continue;
                }
                data['datatables[' + d + ']'] = data[d];
                delete data[d];
            }
        },
        'type': 'POST'
    }
});

In your controller you can then create a form and set the entity to retrieve the data as an object:, (*6)

use Sm\DatatablesFormBundle\Entity\DataTablesForm;
use Sm\DatatablesFormBundle\Form\Type\DataTablesFormType;
...
    public function someAction(Request $request)
    {
        $data = new DataTablesForm();
        $form = $this->createForm(DataTablesFormType::class, $data);
        $form->handleRequest($request);
        // use $data
    }
...

The Versions

09/11 2017

dev-master

9999999-dev http://secamedia.de/

Provides Form Types and Entities representing the DataTables AJAX Request.

  Sources   Download

WTFPL

The Requires

 

by Thomas Rudolph

09/11 2017

v1.1

1.1.0.0 http://secamedia.de/

Provides Form Types and Entities representing the DataTables AJAX Request.

  Sources   Download

WTFPL

The Requires

 

by Thomas Rudolph

14/06 2016

v1.0

1.0.0.0 http://secamedia.de/

Provides Form Types and Entities representing the DataTables AJAX Request.

  Sources   Download

WTFPL

The Requires

 

by Thomas Rudolph