UI Page - dynamically filter with dropdown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2018 01:03 PM
Hi all,
I have a question on a ui page. I feel like I have mostly figured this out. Basically, I have a table "u_weekly_updates". When someone navigates to the ui page, I want them to be able to select a date from a dropdown. I don't think type="date" works in IE yet, and then there's issues with the formatting. So, to get around that, I will just be populating a separate table (u_dates) with the possible dates.
What I want to have happen is when they select a date from the drop down the list is immediately filtered by the value of that date. I have this mostly working, but only if I hard code the dates in the HTML Script.
This is the code I have so far, any ideas on how to push table values into the select box instead of hard-coding??
HTML:
<select id="categorySelect">
<option value="">-- None --</option>
<option value="02-28-2018">-- 02-28-2018 --</option>
</select>
Client Script:
jQuery('#categorySelect').change(function(){
var input, filter, table, tr, td, i;
//input = document.getElementById("myInput");
input = document.getElementById("categorySelect");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2018 07:12 AM
On the other side of the fence... I can do this and populate a reference on the ui page...
<g:ui_reference id="categorySelect2" name="number" table="u_dates" value="${u_date.getDisplayValue()}"/>
but I can't get it to interact with the client script...
//function myFunction() {
jQuery('#categorySelect2').change(function(){
var input, filter, table, tr, td, i;
//input = document.getElementById("myInput");
input = document.getElementById("categorySelect2");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-11-2024 09:51 AM
I have a related issue. Were you ever able to figure this out?