Am I right to use Generator`s "get" & "set" options ?
Am I right to use Generator`s "get" & "set" options ?
I have create datatables form, there I want to have the Editing interface show more detail than in the table. MySQL table 12 columns, but only 8 need to browse. As is described in Generator`s docs, If "get" in current line not checked then the value is not shown in the DataTable but is still available to Editor,i.e. visible, editable and can be saved to database. When I generate this table, I was uncheck gets for 4 little importance fields. Other gets and sets was checked.
I install complete package to test server: http://put-k-diplomu.ru/avtors-tst/Avtors.html
When I add new record, all bee right, but when I start edit this record, I can`t see "get-less" fields(where "get" was unchecked in Generator`s window) values in Editor`s window. When I edit this fields, it`s values are stored in database, but stay unvisible then edit screen starts next time.
What should be done to fix this situation?
Vitaliy.
DataTables debugger`s cod is adejez.
I install complete package to test server: http://put-k-diplomu.ru/avtors-tst/Avtors.html
When I add new record, all bee right, but when I start edit this record, I can`t see "get-less" fields(where "get" was unchecked in Generator`s window) values in Editor`s window. When I edit this fields, it`s values are stored in database, but stay unvisible then edit screen starts next time.
What should be done to fix this situation?
Vitaliy.
DataTables debugger`s cod is adejez.
This discussion has been closed.
Replies
Until then (very soon I hope!), you'll need to add the fields that you want into the PHP fields array in the script that Generator built. The data isn't being obtained from the database at the moment which is why they aren't been shown. What does your PHP script look like?
Thanks,
Allan
Thanks for replay.
It`s here:
[code]
<?php
/*
* Editor server script for DB table Avtors
* Automatically generated by http://editor.datatables.net/generator
*/
// 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\Join,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'Avtors' )
->fields(
Field::inst( 'kod_avt' )
->get( false ),
Field::inst( 'fio_avt' ),
Field::inst( 'fone_avt' )
->get( false ),
Field::inst( 'mail_avt' )
->get( false )
->validator( 'Validate::email' ),
Field::inst( 'smax_avt' ),
Field::inst( 'snorm_avt' ),
Field::inst( 'anti_avt' ),
Field::inst( 'rpret_avt' ),
Field::inst( 'rsrok_avt' ),
Field::inst( 'rstoim_avt' ),
Field::inst( 'rtot_avt' ),
Field::inst( 'dopinf_avt' )
->get( false )
)
->process( $_POST )
->json();
[/code]
Allan
Vitaliy.
I've just altered Generator to have "Table" and "Editor" options rather than "Get" and "Set", as I think the new options will be a lot more useful and more obvious. Thanks for bringing this point up and the discussion!
Regards,
Allan
Just tested. Works from the box), without editing. Great.
Thanks, it just I need.(And others too, I think)
Vitaliy.
P.S.
I understand that the generator is the starter package, but it was great for the newbees (like me) to be able to keep their projects on the disk and load on the need for change data structure and cloning projects