• Resolved sugandh21

    (@sugandh21)


    My table keeps on growing which is resulting in it showing nothing now.
    I tried async=true which results in this error:
    Failed to load resource: the server responded with a status of 500 (Internal Server Error) /wp-admin/admin-ajax.php?&action=dbte_data&table=old_enrollments:1

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author bobbysmith007

    (@bobbysmith007)

    I am not sure that I have ever fully debugged the async data part of things. It definitely would be nice to be able to have it handle automatically chunking and pulling the data at reasonable rate.

    One thing I have done to resolve this without ajax data is to manually page the data by some reasonable metric (eg: only show records entered in the last 6 months) and then to have buttons rendered on the DBTE page that allow you to change the paging parameters.

    I think there is an example in the examples folder:
    https://github.com/AccelerationNet/wp-db-table-editor/blob/master/examples/paging.php
    https://github.com/AccelerationNet/wp-db-table-editor/blob/master/examples/payment-paging.js

    Thread Starter sugandh21

    (@sugandh21)

    The code in paging.php replaces the add_db_table_editor code in function.php right? That seems to not render anything at the moment.
    I have a child theme with function.php and I added the paging.php code in it, replaced the add_db_table_editor with the appropriate code, changed the id in the wp_enqueue_script part but it shows No Database Table Configured to Edit.

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Its just an example, not something you would probably want to copy and paste whole.

    The idea is that you modify the SQL that runs based on a URL parameter (year in the example), with a reasonable default if the value is not sent.

    
          // !!! DONT SQL INJECT !!! This is guaranteed to be a valid integer
          // use wpdb->prepare if you are not sure !!!
          'sql'=>'SELECT * FROM payments'.
                ' WHERE YEAR(date_entered)='.$year.
                ' ORDER BY ID date_entered DESC',
    

    Then code this says, “on appropriate admin pages, enqueue the script that will change the table editor interface”.

    add_action('admin_enqueue_scripts','xxx_register_scripts_admin');
    function xxx_register_scripts_admin (){
          if(@$_REQUEST['page'] == 'dbte_payments'){ // matches 'id' or 'table' above
            $base_url = get_stylesheet_directory_uri();
            wp_enqueue_script(
              'payment-paging.js', $base_url . '/payment-paging.js', Array('jquery'));
          }
        }
    
    

    The javascript, builds next and previous year buttons and adds them to the table editor page and has some code to handle query string variables.

    I hope this helps, but without knowning the details of your table schema / query, its hard for me to provide specific advice.

    • This reply was modified 6 years, 3 months ago by bobbysmith007.
    Thread Starter sugandh21

    (@sugandh21)

    Seems like the add_action calls were not working. If I remove them, the functions works fine so I guess I’ll just go along with that.

    Plugin Author bobbysmith007

    (@bobbysmith007)

    Just FYI, I am working on adding automatic paging support in the next release 1.7.0 Should be up sometime this week or next

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Ajax Error with async’ is closed to new replies.