Forum Discussion

jferrandis's avatar
7 years ago

getting current status of an idea lis filtered by status

Hello everyone,

 

 

I had to make a custom component which filter the idea exchange page by status and i want to add a link remove the filter, like in label. 

Example : 

my idea exhange page has this url http://mycommunity/path/to/idea-exchange

when i filter by idea status it becomes : http://mycommunity/path/to/idea-exchange/status-key/status-key

 

itried to use this snippet to catch the "status-key' value

<#if http.request.parameters.name.status?? >
	<#assign currentStatus = http.request.parameters.name.status?html!"" />
</#if>
<#if webuisupport.path.parameters.name.get("status-key")??>
	<#assign currentStatus = webuisupport.path.parameters.name.get("status-key").text!"" />
</#if>

But it doesn't work

 

Does anyone knows which value i should use

 

thank you for your help

 

  • You Can try this piece of code.

     

    <#assign selectedFilter = webuisupport.path.parameters.name.get("status-key") >

    <br>
    STATUS ID-- ${selectedFilter.id}

    <br>

    STATUS KEY -- ${selectedFilter.key}
    <br>
    STATUS  NAME -- ${selectedFilter.defaultName}

  • You Can try this piece of code.

     

    <#assign selectedFilter = webuisupport.path.parameters.name.get("status-key") >

    <br>
    STATUS ID-- ${selectedFilter.id}

    <br>

    STATUS KEY -- ${selectedFilter.key}
    <br>
    STATUS  NAME -- ${selectedFilter.defaultName}

  • jferrandis

    Here is the snippet to get the param from URL but it would work if your URL is something like this -- 
    https://community.lithium.com?status-key=delivered

     

    <#assign status_key =  http.request.parameters.name.get("status-key", "defualt value goes here")>

    But in your case, there are no params with the URL so you have to use below snippet to get status key from URL

    You can use this to get the URL

    <#assign url = http.request.url />

    And then just use the split method to get the status key. 

    If URL = "http://mycommunity/path/to/idea-exchange/status-key/delivered " 
    then below snippet will return -- "Delivered"

     

    <#assign url = http.request.url/>
    <#if url?contains("status-key")>
    <#assign status_key = url?split("status-key/")[1] />
    ${status_key}
    </#if>