Jump to content

Matching table fields to csv column headers using sortables


MrMastermind

Recommended Posts

Hi,

 

I'm currently writing an import utility where you can select an CSV file and a table.

From there, the fieldnames from the table will be read and the headers from the CSV file.

After that a function will try to match fieldnames with column headers.

 

But to be more generic, I want to be able to have any table and an CSV, where it could be so that the CSV has more or less column headers then there are fieldnames.

To be able to match fieldnames manually It thought of creating an sortable list, so you can match the column headers. Where the fieldnames would be a static list. Something like:

 

fieldnames          matched column headers            unmatched column headers

1                      A                                         

2                      B

3                      C

4                                                                  E

5                      D

6                                                                  F

                       

 

Looking at the example, you can probably see my issue; sortable lists will "collapse" the list and have no empty "slots". So my question would be, how can I create the "matched column headers" and the "unmatched column headers" as a sortable drag&drap list providing some sort of gaps/"slots" to put the unmatched columns in. Or to be able to set a column header matched to an other available fieldname?

 

 

Link to comment
Share on other sites

Ok, I've come a long way. I've created a solution to the problem by creating multiple sortable div's where div's from another list can be dragged into. One small issue remains. I now need to be able to restrict the sortables used as "drop-div's" to only allow one item. So I need to find a way to revert a draggable div when the sortable it is dropped on already contains an item (or element).

 

I figure I have to do that in the onUpdate event, but have no clue how to do it.

 

Any suggestions?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.