I cannot update the screen and therefore the records in the "excel like keyboard navigation" program

I cannot update the screen and therefore the records in the "excel like keyboard navigation" program

guler1guler1 Posts: 6Questions: 2Answers: 0
edited November 2020 in Free community support

hi,

**
I get this error when I send a parameters to staff.php file with POST method in editor of datatables in "excel like keyboard navigation" application. http://e-performans.net/excelgiris/examples/extensions/keyTable8.php
**

keyTable8.php


<? php $ k = '01'; $ t = '2020-01-05'; ?> Sending parameters. ajax: { url: "../../controllers/staff.php", type: 'POST', dataType: "json", data: { k: "<? php echo $ k;?>", t: "<? php echo $ t;?>" } },

staff.php

$ k = $ _POST ['k']; $ t = $ _POST ['t']; // incoming from keytables8.php

-> where ('FatMarker', $ k, '=')
-> where ('Date', $ t, '=')

Result

Records are visible, but when the record in a cell is changed, an error "A system error has occured (more information)" occurs. - when we want to change...


But when I get the same error as a fixed value in staff.php, I don't get it. http://e-performans.net/excelgiris/examples/extensions/keyTable9.php

keyTable9.php

<? php
$ k = '01';
$ t = '2020-01-05';
?>

Sending parameters.

ajax: {
url: "../../controllers/staff.php",
type: 'POST',
dataType: "json",
data: {
k: "<? php echo $ k;?>",
t: "<? php echo $ t;?>"
}
},

staff.php

// !!!! $ k = $ _POST ['k']; $ t = $ _POST ['t']; // incoming from keytables9.php !!!!!! not working

but,


$ k = '01'; $ t = '2020-01-05'; works?. Could I explain? 

-> where ('FatMarker', $ k, '=')
-> where ('Date', $ t, '=')

Result

The records are visible, but when the record in a cell is changed I don't get the "A system error has occured (more information)" error, so it works fine :)


Sample staff.php and other

<?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;

//$k = $_POST['k']; $t = $_POST['t']; // incoming from form
$k = '01';  $t = '2020-01-05';

Editor::inst( $db, "tahsilattbl" )
            
    -> fields(
        Field::inst( 'FatPazarlamaci' ), 
        Field::inst( 'Tarih' ), 
        Field::inst( 'FatCarkod' ), 
        Field::inst( 'Satis' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'Tahsilat' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'KrediKarti' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'Cek' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'BozukPara' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'Nakit' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'Havale' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) ),
        Field::inst( 'HariciGelen' )
            ->validator( Validate::numeric() )
            ->setFormatter( Format::ifEmpty(null) )
    )

    -> where( 'FatPazarlamaci', $k, '=')
    -> where( 'Tarih', $t, '=')

    -> process( $_POST )
    -> json();

    ?>

respects

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin

    Hi,

    The response from the server to your System error issue is:

    Notice: Undefined index: k in /home/eperform/public_html/excelgiris/controllers/staff.php on line 36
    
    Notice: Undefined index: t in /home/eperform/public_html/excelgiris/controllers/staff.php on line 36
    {"data":[]}
    

    Which is correct - a k and t parameter are not being sent to the server on edit. It is for the data get request by DataTables, but you don't have an ajax.data for Editor. See ajax.data for details on how to add it.

    Allan

  • guler1guler1 Posts: 6Questions: 2Answers: 0

    Hello Mr. Allan, thank you for your answer. My problem is solved.

This discussion has been closed.