Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82401

Checkbox one-to-many

$
0
0

Hello,
I am trying to group several mysql fields into a single group of checkboxes instead of several checkboxes.
My code is the following:

$(document).ready(function() {
    var editor = new $.fn.dataTable.Editor( {
        ajax: 'php/table.vin_appellations.php',
        table: '#vin_appellations',
        fields: [
            {
                label: "Appellation:",
                name: "vin_appellations.appellation"
            },
            {
                label: "AOP:",
                name: "vin_appellations.aop",
                type: "checkbox",
                separator: "|",
                options:   [
                    { label: '', value: 1 }
                ]
            },
            {
                label: "IGP:",
                name: "vin_appellations.igp",
                type: "checkbox",
                separator: "|",
                options:   [
                    { label: '', value: 1 }
                ]
            }

Editor::inst( $db, 'vin_appellations', 'appellation_id' )
    ->fields(
        Field::inst( 'vin_appellations.appellation' )
            ->options( Options::inst()
                ->table( 'vin_appellations' )
                ->value( 'appellation_id' )
                ->label( 'appellation' ))
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'Appellation requise' )))
            ->validator( Validate::maxLen( 60 ) )
            ->validator( Validate::unique( ValidateOptions::inst()
                ->message( 'Existe déjà' ))),
        Field::inst( 'vin_appellations.aop' ),
        Field::inst( 'vin_appellations.igp' )

Leading to the following:

I had a look to the example of One-to-many join, which seems to be the lead I need to follow.
I would indeed need something like:

Any idea on how I should amend my php and js code for that?

Thanks and happy new year.


Viewing all articles
Browse latest Browse all 82401


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>