This project has moved. For the latest updates, please go here.

Create Records from Clipboard

Sep 7, 2016 at 12:45 PM
Hi,

i have a feature request for your nice solution "D CRM Editable Grid".

Is it possible to add a new button to create new records from clipboard?

I need this feature because the users want to copy records from excel to crm.

I think this would be possibly only in internet explorer. Here is some useful code:
var clipText = window.clipboardData.getData('Text');
var clipRows = clipText.split(String.fromCharCode(13));
-->clipRows [i][j] = cell

Is this generally possibly in your grid? Can you help me to integrate this feature on my own?
Coordinator
Sep 8, 2016 at 10:49 AM
Edited Sep 8, 2016 at 10:52 AM
Hi,
Is it possible to add a new button to create new records from clipboard?
Yes, it is possible though this will only work with IE. A better approach (works in all browsers) would be to allow the user to load the excel file either using drag&drop or file open mechanism. This allows the user to select one or many records to insert.

Here is how this feature can be added::

Add a file/text field to the grid toolbar.
Use the following library to read excel file SheetJS into an HTML panel containing a table with selectable rows.
For each selected row, use CreateInlineRecord function of the grid to add new records

Note:
If the grid and excel fields don't match then you will need to allow mapping of the fields.

If you wish to integrate this feature on your own and need help, please contact me at mehrhat@gmail.com. Thank you,
Mehrdad
Sep 8, 2016 at 4:21 PM
Hi Mehrdad,

another idea: Would it be possible to have a single text inputfield somewhere, so that a user can Ctrl+C and Ctrl+V selected items from Excel to the Input field.
In the "onChange" event of the text field you could parse the copied field and use the "CreateInlineRecord". I assume the copied content from Excel will contain some delimiters so that it should be possible to parse the Content?!?

Cheers,
Nils
Coordinator
Sep 8, 2016 at 10:37 PM
Hi Nils,

Yes, using your suggestion, it is possible to get the pasted content using both change and paste events.

Note:
There needs to be some sort of structure (JSON) mapping the excel cells to the grid fields before calling the "CreateInlineRecord".

Thank you,
Mehrdad