How to access selected options from a select list to show them in a table ?

82 views
Skip to first unread message

xhoik...@gmail.com

unread,
May 3, 2016, 7:27:09 AM5/3/16
to Django users
So i have a select list and a table,and i want to show only the data that corresponds the selected item.

This is my index.html file 

<select title="my_owners">
<option>Owners</option>
<option selected>-------------------</option>
{% for owner in owners %}
<option value="owner"> {{ owner.person_id }} {{ owner.first_name }} {{ owner.last_name }}</option>
{% endfor %}
</select>
<br/> <br/>
<table border="1">
<tr>
<td>Id</td>
<td>Space</td>
<td>City</td>
<td>Street</td>
<td>Price</td>
<td>Purpose</td>
</tr>


{% for info in information %}

<tr>
<td>{{ info.owner_id }}</td>
<td>{{ info.space }}</td>
<td>{{ info.city }}</td>
<td>{{ info.street }}</td>
<td>{{ info.price }}</td>
<td>{{ info.get_purpose }}</td>
{% endfor %}

</tr>

</table>

Ricardo Daniel Quiroga

unread,
May 6, 2016, 8:39:16 AM5/6/16
to django...@googlegroups.com
Hello,
What you must do is to use Javascript and AJAX, to have the desired behavior, I guess would be for onchange event. By the way it is therefore desirable to handle the tables in the following format

<Table>
   <Thead>
        <! - Header here ->
   </ Thead>
   <Tbody id = "content">
   </ Tbody>
</ Table>

regards

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e3502e4e-c58b-46e7-8201-9b07edcca7dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Ricardo Daniel Quiroga

Reply all
Reply to author
Forward
0 new messages