1

I am creating a program with python that takes a CSV file, filters it and shows it to the user as a filtered file. That works great, but I have a problem when I want to implement dropdown menus for my table.

I used to_html()and <div class="table-responsive">{{data| safe}} </div> to import the file on the html side as a table. I used javascript/jquery to implement the add/remove buttons, search box. What I can't figure out is how to add dropdown menus, since my table is not shown with HTML tags and each time has a different number of rows.

I have 23 columns and only 3 of them should have dropdown menus from which the user should choose a value for each row.

I created a fiddle to show how it looks currently. Bear in mind that here I just hardcoded my table for the example.- I did insert the class and id for the table on the python side so I can access the inputs in the table.

https://jsfiddle.net/2gw09vpr/1/

Currently, I added an attribute contendEditable for the columns 4,5 and 6 where there should be a dropdown list to choose from. How can I do that?

I am new to python/jquery/js so I am lost on how to do it. What I tried so far was similar to this:

fiddle 1 ; fiddle 2 ;fiddle 3

stackoverflow

And nothing works for me. Any help would be appreciated.

Pushprajsinh Chudasama
  • 7,772
  • 4
  • 20
  • 43
miwa_p
  • 435
  • 1
  • 4
  • 19
  • What would the dropdown lists contain? Are the lists going to be populated by your Python program? If so, it might help to show the Python code as well. – Doug F Sep 12 '19 at 14:42
  • the dropdown lists would be filled with the values from arrays example: (``arr1=[a,b,c,d]``) – miwa_p Sep 12 '19 at 15:05
  • 1
    Are the arrays in your JavaScript code and you're just looking to see how to populate them? If so, have you tried something like https://stackoverflow.com/a/3446086/3830432 ? If you're looking for something different, I apologize. – Doug F Sep 12 '19 at 15:16
  • thanks for answering, tried it but it just adds all of the lists in the first row . I need dropdown in each row in the same column – miwa_p Sep 13 '19 at 12:53
  • Can you please post what you tried? It might help with getting this working. – Doug F Sep 14 '19 at 13:31

0 Answers0