Table suddenly stopped updating, and Editor window won't close
Table suddenly stopped updating, and Editor window won't close
Ok, this code has worked fine for a month now, and then last week it suddenly stopped updating!. I have went over everything I can think of and I am at a loss. I can load the table, and open the editor window. When I make an update and call submit, I see the little icon at the top of the editor screen and that's all the table is not updated. To make things more weird, most of the current entries and updates were made with the SAME module. I installed the debugger and got no errors but the suggestion to upgrade to a newer version (which I did). Am I missing something simple ( i hope ) Thanks' for anyone's insight.
server side script (php): I streamlined this one for testing and debugging, but it is still not updating:
<?php
// DataTables PHP library
include( "Editor-PHP/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,
DataTables\Editor\SearchBuilderOptions;
/*
* Example PHP implementation used for the join.html example
*/
Editor::inst( $db, 'PrisonFacilityListing', 'Facility_ID' )
->fields(
Field::inst( 'Facility_ID' ),
Field::inst( 'Facility_Type' )->validator( 'Validate::notEmpty')
->options( Options::inst()
->table( 'FacilityTypes' )
->value( 'Type' )
->label( 'Type' )
)
->searchBuilderOptions( SearchBuilderOptions::inst()),
Field::inst( 'Prison_Name' )->validator( 'Validate::notEmpty'),
Field::inst( 'Address_1' )->validator( 'Validate::notEmpty'),
Field::inst( 'Address_2' ),
Field::inst( 'Address_3' ),
Field::inst( 'City' )->validator( 'Validate::notEmpty')
->searchBuilderOptions( SearchBuilderOptions::inst()),
Field::inst( 'State' )->validator( 'Validate::notEmpty')
->searchBuilderOptions( SearchBuilderOptions::inst()),
Field::inst( 'Zipcode' )->validator( 'Validate::notEmpty'),
Field::inst( 'Mailing_Notes' ),
Field::inst( 'Phone_Number' ),
Field::inst( 'Mail_Addr_1' )->validator( 'Validate::notEmpty'),
Field::inst( 'Mail_Addr_2' ),
Field::inst( 'Mail_Addr_3' ),
Field::inst( 'Mail_City' )->validator( 'Validate::notEmpty'),
Field::inst( 'Mail_State' )->validator( 'Validate::notEmpty'),
Field::inst( 'Mail_Zip' )->validator( 'Validate::notEmpty'),
Field::inst( 'Pkg_Addr_1' ),
Field::inst( 'Pkg_Addr_2' ),
Field::inst( 'Pkg_Addr_3' ),
Field::inst( 'Pkg_City' ),
Field::inst( 'Pkg_State' ),
Field::inst( 'Pkg_Zip' ),
Field::inst( 'Alt_Addr_1' ),
Field::inst( 'Alt_Addr_2' ),
Field::inst( 'Alt_Addr_3' ),
Field::inst( 'Alt_City' ),
Field::inst( 'Alt_State' ),
Field::inst( 'Alt_Zip' ),
Field::inst( 'Website' ),
Field::inst( 'DOC_ACR' ),
Field::inst( 'eOnly' ),
Field::inst( 'eProvider' )
->options( Options::inst()
->table( 'eProvider' )
->value( 'name' )
->label( 'name' )
),
Field::inst( 'EditedBy' )->validator( 'Validate::email' ),
Field::inst( 'correspondence' ),
Field::inst( 'publications' ),
Field::inst( 'books' ),
Field::inst( 'timestamp' )
)
->debug(true)
->process( $_POST )
->json();
This question has an accepted answers - jump to answer
Answers
I even made a standalone page, in hopes of finding the problem. Here is the relevant JS:
Here's the debug SQL as well:
Does it stop, or does it stay there forever? Does the Editor window close?
Can you show me the entire response from the server please (from the "raw" view - not the parsed JSON view)?
Allan
Sure, because of the size, it won't post here, but I will provide a link. The editor window will close if I press the X or Cancel button. Raw response link: (https://drive.google.com/file/d/1kc0QnOceVE_hZCmXI0WAogn2ygTcNtCi/view?usp=sharing "https://drive.google.com/file/d/1kc0QnOceVE_hZCmXI0WAogn2ygTcNtCi/view?usp=sharing")
Does it stop, or does it stay there forever? Does the Editor window close?
Sorry, yes it's there for about a second and disappears
It might be a copy / paste issue with new lines, but that isn't valid JSON. It has new lines in it. I assume you don't get a "System error" error message when you submit the Editor form?
I'm also concerned that this appears to be the entire data set. Not just the result of an update / edit. Is this the JSON from after submitting an edit? There isn't an
UPDATE
statement listed in the SQL executed. I suspect this is the data from the initial table load? Can you show me the raw response from an edit action please?Thanks,
Allan
So I am not getting an update after submitting an edit. It's whatever your module is throwing back. I will re-write the script after my launch on the 1st. I am not having problems with any other tables using editor, well except for not being able to use the upload plugin with databasename.tablename.table notation. Sometimes I am finding it easer NOT to use editor for complex queries, which this is not, so I am stumped especially since it worked fine for over a month. Thanks for looking into it. Most of the data is in, and good enough for launch. If it still doesn't work after I rewrite it, I'll ask for help again.
P.S. Still need a workaround for getting the upload plugin to work, I really need to use editor for that project.
Okay thanks for letting me know. Let me know how you get on.
I've got it in a tab to look into in more detail.
Thanks,
Allan
okay, here's what I got. When the table loads I get this:
When I submit an edit, and press the submit button, I get no response at all. Hope that helps!
Added this
You won't see a response using the
xhr
event for thetable
, which is the Datatable, as the response you are looking for is from the Editor's ajax request. Use the browser's network inspector tool to see the XHR response. See the steps in this technote.Kevin
Friggin heck!. Thanks so much @kthorngren !
Showed me where the problem was (BTW was a field failing validation that was collapsed so I didn't see the warning. Geesh!)
Two awesome tools in one Day