CSV Import preceding Field column with table and/or adding joins is an issue

CSV Import preceding Field column with table and/or adding joins is an issue

cpshartcpshart Posts: 246Questions: 49Answers: 5

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

Hi

I have replicated the following CSV Import set-up successfully, so it imports the CSV data as expected.

https://editor.datatables.net/examples/extensions/import.html

but I need to create a more complicated version for my system including joins, so the server file will require the table to precede all Field values.

so I modified the server file preceding each Field Column with datatables_demo. as shown below

the effect of making this change is that no JSON data is created, so the file is not imported

In all other respects the up to this point the import works, with no changes to the client file, i.e. the form is populated with the CSV file data

I have tried changing the client file as shown in the call below, so preceding datatables_demo. against all columns, but this fails to populate the CSV Import form, and the table data.

there is no conclusion or solution to the call below which is the same problem as I am having.
https://datatables.net/forums/discussion/comment/184931/#Comment_184931

The suggestion in this call did not fix the problem.
https://datatables.net/forums/discussion/68069

<?php

/*
 * Example PHP implementation used for the index.html example
 */

// DataTables PHP library
include( "../lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
    DataTables\Editor,
    DataTables\Editor\Field,
    DataTables\Editor\Format,
    DataTables\Editor\Mjoin,
    DataTables\Editor\Options,
    DataTables\Editor\Upload,
    DataTables\Editor\Validate,
    DataTables\Editor\ValidateOptions;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'datatables_demo' )
    ->fields(
        Field::inst( 'datatables_demo.first_name' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'A first name is required' ) 
            ) ),
        Field::inst( 'datatables_demo.last_name' )
            ->validator( Validate::notEmpty( ValidateOptions::inst()
                ->message( 'A last name is required' )  
            ) ),
        Field::inst( 'datatables_demo.position' ),
        Field::inst( 'datatables_demo.email' )
            ->validator( Validate::email( ValidateOptions::inst()
                ->message( 'Please enter an e-mail address' )   
            ) ),
        Field::inst( 'datatables_demo.office' ),
        Field::inst( 'datatables_demo.extn' ),
        Field::inst( 'datatables_demo.age' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'datatables_demo.salary' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'datatables_demo.start_date' )
            ->validator( Validate::dateFormat( 'Y-m-d' ) )
            ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) )
            ->setFormatter( Format::dateFormatToSql('Y-m-d' ) )
    )
    ->debug(true)
    ->process( $_POST )
    ->json();

any help much appreciated, is what I am attempting possible, as ultimately I need to perform an import using joins in the server file, which means that the fields must be preceded by the table name which is resulting in no data showing the Network tab.

I can provide access to my system if required.

Many Thanks

Colin

Answers

  • cpshartcpshart Posts: 246Questions: 49Answers: 5

    Hi

    I may have answered my own question, by modifying the client script on my set-up. I will post the details if applied to this test example once I have fully working system.

    Thanks

    Colin

Sign In or Register to comment.