SelectField to create dropdown menu - javascript

I have a database with some tables in it. I want now on my website has the dropdown and the choices are the names of people from a column of the table from my database and every time I click on a name it will show me a corresponding IDĀ also from a column from this table. how I can do that? or maybe a guide where should I find an answer !
many thanks!!!

You have to do that in python(if that's what you are using in the backend).
You can create functions in python that gets the list of name of tables which then you can pass to your front-end code. Similarly, you can setup functions where you get the specific table name from HTML and pass it to python and do all sort of database queries.
If all these sounds confusing to you. I suggest you take a Full stack course on udemy, youtube, etc because it can't really be explained in one simple answer.
I hope it was helpful. Feel free to ask me more

Related

reactive dropdown

I'm new to flask and webdev. I cant seem to find any true helpful resources on how to create a reactive dropdown list.
I have 2 variables in another file from a textfile I've formatted. I want to use them in the webapp. They are [1] first authors and [2] total authors
[1] first authors is a list of authors and it should be the values the dropdown menu will have.
[author1,author2,author3]
[2] total authors is a dictionary where each key is a different first author and the values are the coauthors
author1: [helping authors]
author2: [helping authors]
author3: [helping authors]
I want a dropdown menu that when you choose an author, it will show all coauthors
I've copied some code from here but all I've gotten to show is the dropdown menu that dosen't react
This is entirely a JavaScript thing; I am not really familiar with flask but had to do the same thing few month ago with Django and I couldn't really find a better solution than to implement it using Ajax.
If you aren't familiar with Ajax Here is a great place to get you started.
This response may also help you.
You can also simply use only JavaScript by loading all your data to a template and dealing with your conditions using JavaScript (maybe an event listener 'change' to a form).

Creating breadcrumbs for table navigation VUEJS

I'm a Junior Developer and I'm currently having a big issue with breadcrumbs.
For this application, I'm using VueJS and the problem I'm having is the following:
*The user clicks on 'tables' and is sent to the 'tables' page.
-On that 'tables' page, he has a big table in which he's able to click on the various columns to show a new table with data relevant to the column he clicked on.
*For this I'm on the same component so I'm not using routers, but using v-show as I don't want the tables to rerender.
My problem is the following, I have to make a breadcrumbs as he navigates to the different tables (ie: table/holdingList/entrepriseList/clientList..). and they have to be clickable so that I'm able to create a function that injects data into the table or to simply 'show' it and close the others.
Can anyone give me a brief out-line of how to do this? Sorry if it seems trivial. I've already spent a couple of days on it and my brain has turned to mush...
I will start from the easiest solution to implement:
Each v-show will depend on a different data object. Then your breadcrumb has an #click method that will set every v-show data object to false. Give the method a parameter with the name of the data object that you intend to show and display that to true.
The previous answer is enough to get it working. Other ways of achieving the same result in a more maintainable way are:
Create one data object named as activeTable and turn your v-show into a v-if. When you click on the breadcrumb element you change the activeTable data object to an identifier for the table you wish to display. After that your vue-if simply checks if the activeTable === thisTableId. Where thisTableId is the identifier of each table.
You may want to start getting acquainted with Vuex specially if your tables share a similar layout. In that way you will store the data and there is no need to request your data again. This is useful if the data to populate your tables come from an API.
Finally on an SPA architecture there is no actual re-render so you may possibly want to look at that as well.
Please read the guidelines for posting an answer since they require you to show at least some effort from your side. Good Luck!

Dynamically add objects to list from dropdown

I'm going to try and put this in the simplest terms and hopefully someone can help me. I'm new to MVC and i'm trying to learn the ropes.
I have an dropdown that is populated with tenant objects.
I want a user to be able to select a tenant in the drop down, and have that tenant added to a list (Enumerable of Tenant objects) and displayed below the dropdown in a section called "Added Tenants" while also removing the selected tenant from the dropdown.
I don't want these tenants added to the database until later because this is a form creating a lease, and i want them to finish filling out the rest of the lease and create it all at once.
I'm hoping someone can help me or at least point me in the right direction. Yes i have done searches but haven't found anything yet that will help me or that i understood.
Edit: The list can be of object, just an id, or even a select list. The end game is to use that list to add them to the collection which is a 1 to many relationship. That list will also be used to populate partial views with the tenant information, kind of like how the tags work in stack overflow.
While it's not clear what the "list" is that you want added to (i.e. a UL or a form select list), but this solution is going to be done in javascript, not ASP.
Try doing a few searches on SO. Such as:
jQuery moving MultiSelect values to another MultiSelect

Issue with Twitter Lists not displaying correct tweets

Twitter Lists are not working?
My client has made a list with the people that he wants to show tweet's from.
List can be viewed here: https://twitter.com/Leidsverzet/top
It contains 5 persons.
The embedding works correctly but I am experiencing something really strange: Not all the tweets from these 5 persons are displayed!!!
In order to test further I made a [single person test list] with only one person to to test. That list works correctly except that it does not display that user's replies.
I am understanding something wrong here? Aren't twitter lists something like groups, where you can put people like family or prof connections and just see their timelines?
A small footer note on why I wan't to use lists is because the twitter search plugin is not working correctly as well, so instead of using search queries I had trust that the lists would do the trick, but apparently not. Or twitter search feeds and list's are not good or I am lost somewhere here.
Contacted Twitter and issue is solved.
take care
These list might also have been corrected by time eg(crawling time etc)
I just want to add that I found this while looking for solutions to my own list problem, and one thing that resolved my issue was to edit the list, delete the person whose tweets are not getting displayed, and then add them back.

Jquery Table plugin

I need a table plugin that does the following
Uses json and html table as the datasource
supports pagination
can specify how many rows to show by the user(i.e user can change rows per page)
sorting of columns
searching (complex searching options is welcome)
free for commercial projects
dynamic addition/deletion
refresh option
Finally the main requirement is searching, sorting,pagination all needs to happen client side. No server interaction needed.
One more thing dont know if possible say i have 1000 records i want 100 to show up initially in 10 pages (i.e 10 each in 10 pages) only when user clicks on page 11 it fetches next 10 from server
Thanks
The jQuery DataTables are really pretty, and easy to use. http://www.datatables.net/ Lets you roll your own theme super easy. You can build from html or ajax.
You can go check out http://flexigrid.info/ . Its not a table exactly its a grid but you might be able to use it in the same way. It accepts JSON and allows a lot of different ways to change display.
this is what you're looking for: http://www.trirand.com/blog/jqgrid/jqgrid.html

Categories

Resources