Filtering Columns on a Custom Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2024 08:29 AM
I have a custom table with 3 columns.
I'm trying to use a reference variable in my form.
I'd like to filter Column2 pulldown in my form based the selection from Column 1.
I'd like to filter Column3 pulldown in my form based the selection from Column 2.
Here's a sample.
What's the best way to handle this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2024 08:55 AM
Hi @Joe Taylor ,
May be you can set the column 1 as dependency value for column 2 & 3. Please let me know if you've any questions.
Please mark the answer helpful, if it helped you accordingly.
Thanks,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2024 12:25 PM
I'm not sure how to implement this.
Do you mean the "Dependent" and "Dependent on field" columns in the database?
If so, I still don't know how to adjust the pulldowns in my form.
Each column has it's own pulldown and refers to one of these columns.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2024 08:09 AM
Hari's suggestion isn't detailed enough for me.
Does anyone have any further advice for me on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2024 08:17 AM
you can achieve this functionality using Client Scripts
(function() {
// Define function to filter Column 2 based on Column 1
function filterColumn2() {
var column1Value = g_form.getValue('column1'); // Get the value of Column 1
var column2Field = g_form.getControl('column2'); // Get the reference to Column 2 field
// Clear existing options
column2Field.innerHTML = '';
// Populate Column 2 options based on Column 1 selection
// Implement your logic here to fetch options dynamically, e.g., via GlideAjax
// Add options to column2Field using DOM manipulation
}
// Define function to filter Column 3 based on Column 2
function filterColumn3() {
var column2Value = g_form.getValue('column2'); // Get the value of Column 2
var column3Field = g_form.getControl('column3'); // Get the reference to Column 3 field
// Clear existing options
column3Field.innerHTML = '';
// Populate Column 3 options based on Column 2 selection
// Implement your logic here to fetch options dynamically, e.g., via GlideAjax
// Add options to column3Field using DOM manipulation
}
// Register onChange handlers for Column 1 and Column 2
g_form.observe('change', 'column1', filterColumn2);
g_form.observe('change', 'column2', filterColumn3);
})();