SHow/ HIde List collector variable options.

ar1
Kilo Sage

Hi All,

Can anyone please help us on the below requirement.

 

We developed one catalog with few variables.

In that one variable callled Company (Select Box type) with drop down options.

ANd another variable called Region (List collector type ---> Refer to Regions table ---> Region field {List field type}).

 

And now we want to display the Region choices in slush bucket based on the Company variable selection.

 

Can anyone please help us with sample script.

Note: Gone through few link in community but no luck.

Advance thanks for the support.

1 ACCEPTED SOLUTION

ar1
Kilo Sage

Hiii,

Below script working fine for us.

Many thanks to @Ankur Bawiskar  and  @Allen Andreas .

 

Client script:

function onChange(control, oldValue, newValue, isLoading) {
var headers = g_form.getControl('u_region').parentElement.querySelectorAll('.col-xs-4');
 var collectorName = 'u_region';
var filterString = '';    
    if(newValue == 'Australia'){
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustralia';
    }
    else if(newValue == 'Austria')
    {
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustria';    
    }

    setCollectorFilter();
    
function setCollectorFilter()
{
//If it hasn't rendered yet, wait 100ms and try again.
if(typeof(window[collectorName + 'g_filter']) == 'undefined')
{
setTimeout(setCollectorFilter, 50);
return;
}
//Reset the filter query
window[collectorName + 'g_filter'].reset();  
window[collectorName + 'g_filter'].setQuery(filterString);  
window[collectorName + 'acRequest'](null);  
//Redisplay the list collector variable
//g_form.setDisplay(collectorName,true);
    
}

   
}

 

View solution in original post

10 REPLIES 10

ar1
Kilo Sage

Hiii,

Below script working fine for us.

Many thanks to @Ankur Bawiskar  and  @Allen Andreas .

 

Client script:

function onChange(control, oldValue, newValue, isLoading) {
var headers = g_form.getControl('u_region').parentElement.querySelectorAll('.col-xs-4');
 var collectorName = 'u_region';
var filterString = '';    
    if(newValue == 'Australia'){
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustralia';
    }
    else if(newValue == 'Austria')
    {
        filterString = 'question.nameSTARTSWITHu_region^textNOT LIKEAustria';    
    }

    setCollectorFilter();
    
function setCollectorFilter()
{
//If it hasn't rendered yet, wait 100ms and try again.
if(typeof(window[collectorName + 'g_filter']) == 'undefined')
{
setTimeout(setCollectorFilter, 50);
return;
}
//Reset the filter query
window[collectorName + 'g_filter'].reset();  
window[collectorName + 'g_filter'].setQuery(filterString);  
window[collectorName + 'acRequest'](null);  
//Redisplay the list collector variable
//g_form.setDisplay(collectorName,true);
    
}

   
}