Server side php auto format a string value '000168' to int '168'

Server side php auto format a string value '000168' to int '168'

support armonysupport armony Posts: 6Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi,
I've a problem with a server-side php script wich return data from a mysql datatable.
My Colum is typed nvarchar(25)
The server-side PHP returns all the line.
When the data begin with a caracter the json rendering is ok
BUT when the data seems to be a number like 000168 it's return a formated number 168 instead of a string '000168'.
Is it possible to disable this auto formating.

I try to force a return value in string with the getFormatter option but it didn't change everything
_
Extract of the code
Field::inst( 'SUBSCRIBER.SUBSCRIBER_NUM' )
->getFormatter( function ( $val, $data ) {
$chaine = 'zzz';
$chaine .= strval($val);
return substr($chaine,3);
} ),

Sample of result in Json
Good value : "SUBSCRIBER":{"SUBSCRIBER_NUM":"GUI010","SUBSCRIBER_ID":47}
Bad value : "SUBSCRIBER":{"SUBSCRIBER_NUM":168,"SUBSCRIBER_ID":50}

_

Replies

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    It would be worth looking at this thread as it is discussing this issue. If still no joy, please let us know,

    Colin

  • support armonysupport armony Posts: 6Questions: 1Answers: 0

    Thank you. I upgrade my Editor and Datatable version. Now it's working fine!
    Thank's for our help.

Sign In or Register to comment.