Hi all,
I download data from a listgrid into a csv file with exportData.
Very simple and very effective. Except that is putting in the file the listgridfield titles and not the names. The titles have a <span> with CSS style to make some of them bold. How do I put the names instead?
Now the bigger question:
After the user makes some modifications in the csv file in Excel (I'm using CSV since XLS uploading is not yet supported), I'd like to reimport the data into the grid by uploading the same file. I do not need the user to review the changes in an additional grid after the validation as in the BatchUploader sample.
I would like to make following:
- let the user upload a csv file, verifying the file extension (probably client side?)
- get the data from the file and, for the records where primary key and fields match, update the data in the grid. I was thinking sending the file to a servlet with a FileItem in a dynamic form, parse it into Pojos, send back to the client the data in any data structure and programmatically doing the match client side
- At the callback, prompt the user with a confirmation window with a summary of how many records are going to be updated, and at user confirmation, save the changes reusing my saving mechanism (the editing is not with datasource save, it's done in a dynamic form editor that bulk saves the changes sending data to the backend by RPC and refetches the grid at callback).
The grid has a dynamic datasource. In the BatchUploader sample the records are added to the grid. Mine is an update of records. Also, it's using a Hibernate datasource while I have a dynamic datasource. In the same example, I can't find the servlet that handles the request (specifically, the exampleTransactionManagerController).
Can you please indicate the simpler way to do what I need with some example code?
Is it possible to use a FileItem in a dynamic form to send the uloaded file to a servlet, parse the data into Pojos, and send them back to the client for validation and processing like I want to do?
Thanks,
Vittorio
=========== ENVIRONMENT DETAILS ===========
smartgwt.version:4.1.d20130712
SmartClient Version: SNAPSHOT_v9.1d_2013-07-12/PowerEdition Deployment (built 2013-07-12)
Firefox 25.0
I download data from a listgrid into a csv file with exportData.
Very simple and very effective. Except that is putting in the file the listgridfield titles and not the names. The titles have a <span> with CSS style to make some of them bold. How do I put the names instead?
Code:
private void downloadCsv() { DSRequest dsRequestProperties = new DSRequest(); dsRequestProperties.setExportAs(ExportFormat.CSV); dsRequestProperties.setExportDisplay(ExportDisplay.DOWNLOAD); List<String> gridFields = MainPanel.getGrid().getFieldsNames(); dsRequestProperties.setExportFields(gridFields.toArray(new String[0])); MainPanel.getGrid().exportData(dsRequestProperties); }
After the user makes some modifications in the csv file in Excel (I'm using CSV since XLS uploading is not yet supported), I'd like to reimport the data into the grid by uploading the same file. I do not need the user to review the changes in an additional grid after the validation as in the BatchUploader sample.
I would like to make following:
- let the user upload a csv file, verifying the file extension (probably client side?)
- get the data from the file and, for the records where primary key and fields match, update the data in the grid. I was thinking sending the file to a servlet with a FileItem in a dynamic form, parse it into Pojos, send back to the client the data in any data structure and programmatically doing the match client side
- At the callback, prompt the user with a confirmation window with a summary of how many records are going to be updated, and at user confirmation, save the changes reusing my saving mechanism (the editing is not with datasource save, it's done in a dynamic form editor that bulk saves the changes sending data to the backend by RPC and refetches the grid at callback).
The grid has a dynamic datasource. In the BatchUploader sample the records are added to the grid. Mine is an update of records. Also, it's using a Hibernate datasource while I have a dynamic datasource. In the same example, I can't find the servlet that handles the request (specifically, the exampleTransactionManagerController).
Can you please indicate the simpler way to do what I need with some example code?
Is it possible to use a FileItem in a dynamic form to send the uloaded file to a servlet, parse the data into Pojos, and send them back to the client for validation and processing like I want to do?
Thanks,
Vittorio
=========== ENVIRONMENT DETAILS ===========
smartgwt.version:4.1.d20130712
SmartClient Version: SNAPSHOT_v9.1d_2013-07-12/PowerEdition Deployment (built 2013-07-12)
Firefox 25.0
Comment