Okay
  Public Ticket #1044209
Structural Changes to Queries
Closed

Comments

  •  2
    bkonia started the conversation

    Just an observation...

    When working with MySQL tables, it seems that once you create a wpDataTable, making any subsequent changes to the query which the table is based on, results in a mess. For example, if you delete or rename columns in the query and then save the updated query, you end up with weird MySQL errors and/or jQuery errors on the page where the shortcode appears.

    This has happened to me several times now. Both times, I was able to fix it by simply deleting the wpDataTable and recreating it. When I recreated it, I used the exact same query that had generated errors before and it worked fine, so this proves there was nothing wrong with the query. The problem is caused by changing the query after the wpDataTable has been created.

  •  1,771
    Miloš replied

    Hi bkonia,
    Thank you for your purchase.

    There is a possibility getting the problem when you try to change number, type and position of the columns.
    Our plugin is not a mysql management system, it is just and input where you can paste or write query.
    So if you need to change something in query I suggest you first to do/write it in phpmyadmin or in some other database management system before you enter it in our plugin.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    bkonia replied

    I'm quite familiar with MySQL and have used it for many years. This is not a MySQL issue and it's not a problem with my query, it's an issue with your plugin. When I make changes to the query AFTER creating a wpDataTable, I get jQuery errors and other strange results. For example, suppose I enter the following query:

    SELECT column1, column2, column3 from mytable where column4 = %CURRENT_USER_ID%

    After entering this query, I click the Save button. When I view the wpDataTable on the web page, everything works fine.

    Now, I go back to the admin screen and change the query to this:

    SELECT column1, column2 from mytable where column4 = %CURRENT_USER_ID%

    It's the EXACT same query, except I removed one column. After clicking Save, I return to the web page and refresh it. Now it's a mess. The table doesn't render properly and when I view the console, I can see jQuery errors. It seems that editing the query for an EXISTING wpDataTable has some bug, which breaks the table.

  •  2
    bkonia replied

    The point is, I did not make any changes to the underlying table. I simply removed a column from the query.

    However, even if I did change the structure of the table, why should it matter? When saving the wpDataTable, it should save it based on the current table structure and the query design. You shouldn't have to delete the entire wpDataTable and start over from scratch any time you make changes to your table or query.

  •  1,771
    Miloš replied

    Hi bkonia,

    Unfortunately, when you create MySQL table for the first time using our plugin, it is not possible to change the numbers of the columns or type and position of them (or in your case removed a column from the query).
    We are working to change that for our future 2.0 version so stay tuned.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables