Okay
  Public Ticket #2718058
Column order lost on upload
Closed

Comments

  • John J Hannon started the conversation

    When uploading an updated spreadsheet to an existing table, the column order is lost, reverting to the order the column appear in the spreadsheet.

  • [deleted] replied

    Hi John

    Thank you for reaching out to us. 

    Can you please tell me what you mean by "uploading an updated spreadsheet to an existing table" - which spreadsheet are you referring to? Excel, or Google Spreadsheet? How are you uploading it? Are you overwriting the same file? 

    Tables linked to an existing data source saves the structure and the path to that source in wp_wpdatatables database table, so if you upload the same file again, it's being redone. It cannot keep the structure if you're changing the file, but you can replace the file in ../wp-content/uploads/YEAR/MONTH/ folder (keeping the same structure and the same file name), and that should work

  • John J Hannon replied

    This is an Excel file. I'm updating the data source by going into the existing wpDataTable and clicking browse, and uploading a new file. 

    wpDatatables allows you to re-order the columns on your table. It should preserve that user-created metadata (the column order), not throw it away when you upload new data. It's not reasonable to expect site admins to go grubbing around on the filesystem in order to preserve it. They don't have access.

  • [deleted] replied

    Hi John

    To update the table by importing the CSV file again, you'd need to remove the headers and existing rows, and include only new rows. Then, in the database, find the wp_wpdatatable_# that was created, and then import that new CSV file in there. 

    Another option would be to view the table in Excel-like mode in back-end, and then bulk select; copy and paste the data from Excel. 

    There's no way of updating the existing table by just uploading the new CSV file. The plugin doesn't have those options yet, so updating it through the database, or copying a range of cells into Excel-like view is the only solution for now.


  • John J Hannon replied

    You understand it's not reasonable to expect users to filter out and upload just new rows right? That excel files will typically live elsewhere, and rows are often added non-sequentially? And that rows are not just added, but updated as well? This is a huge issue for us. When do you expect this functionality to be in the plugin? We chose this plugin specifically because it seemed to offer the ability to update periodically from an offline Excel file.

  • [deleted] replied

    Hi John

    I see you are creating a table linked to an existing source? If you go to wp- Content/Uploads/Year/Month you can edit the source file but please note the following is not allowed: reordering, renaming, removing or adding columns, only rows can be edited or added.

  • John J Hannon replied

    I do understand what you're saying. What I'm saying is that you're disregarding the primary use case for your own plugin: a spreadsheet that lives elsewhere, but is displayed on the web. It is not reasonable to require the spreadsheet to live primarily in the uploads folder of a Wordpress instance. It IS reasonable for me to expect that metadata I've entered through the WP interface be kept when I upload an updated spreadsheet. Please don't pretend this isn't a bug. You keep all the conditional formatting metadata. You keep column widths, css classes, etc. Keep the column order too.

  • [deleted] replied

    Tables linked to an existing data source create the structure of the file in a database table wp_wpdatatables_columns, and the settings for those tables are saved in wp_wpdatatables table in the database. Excel and CSV based tables are using wordpress' function wp_upload_dir() for location of upload files. By default is set to the upload folder (wp-content/uploads).

    When you try to overwrite the file by uploading another file in an existing wpDataTable, by clicking on the Browse button, you're uploading a file with a different structure, which is not recognized by the plugin, since its structure already exists in wp_wpdatatables_columns database table. Like mentioned before, you can replace the file with the file of the same structure (same headers, column order, column count) and that will work. Uploading a file of a different structure will not since it is generated by an initial import and is linked to the table's ID. It is not a bug, but the way the plugin currently works. 

    I'm sorry that your understanding of what wpDataTable's primary use case is not what our plugin is capable of doing, but at the moment this is the limitation of working with tables linked to an existing data source. I'm not saying that our developers will leave it as it is forever, but at the moment its behavior can't be changed.

    Please feel free to post this as a feature suggestion on this page, so our developers can add your vote in regard to this functionality.

  • John J Hannon replied

    Again, expecting site editors to have access to the uploads folder is INSANE. If you don't get that I don't know what to tell you. Really disappointed in your product.

  • John J Hannon replied

    A bit of clarification: I'm not uploading a file with different columns or anything. I'm uploading THE SAME FILE and losing my customizations. 

  • [deleted] replied

    Hi John

    Only Administrator roles have access to wpDataTables in back-end, and only in back-end you can create new or edit existing tables. The plugin is not intended to work for "Editor" role, if that's what you're referring to. Users don't have access to the "uploads" folder, but since wpDataTables is using WordPress' function wp_upload_dir() for location of upload files, it is set to wp-content/uploads. It's the same as it is for your Media library. If you upload the file in the media library, it's saved in that folder. Tables are linked to an existing data source, so that source needs to reside somewhere - uploads folder.
    I'm sorry that you had different expectations of the plugin, but I already explained how the plugin works, and why it works in that way.