Populate dropdown value for previously selected values in Listview

0
Hi Team, I have the Listview where I have bind the dropdown values but if last time some value is selected then it should populate the dropdown with that selected value. please guide.
asked
3 answers
4

Hi Priyanka,

What I understood is , You have a editable list view, you are selecting a drop down value but when next time while you open the page,previous selected value is not there.

 

If that’s the case, have a on change event for dropdown and commit the object in on change microflow.

 

Thanks.

answered
0

Hi Priyanka ,

If I understand your use case correctly you want a dropdown , where the selection persists on page reload .

  • You need to create a searcher entity and associate it with your main entity ,  Change Data source to microflow ,and retrieve the list based on search attribute.
  • This way your data will always reflect based on your selection.

Thx

answered
0

hii  Priyanka,

here is trick to do this 

i understand your question you want to keep selected you dropdown after page refresh.

  • firstly on change of dropdown call a nanoflow and inside nanoflow call a javascript action and pass the current selected value of dropdown in js action parameter   

and in js action code tab inside your function you will get a paramter keep remember to tak input parameter in js action 

and then go to code tab there 

current parameter value set to the browser session storage 

window.sessionStorage

afetr that make a key and set your parameter value to the browser session storage

sessionStorage.setItem("key", "yourParamterValue");

now till there you set your dropdown value to the session strorage of the browser so your last selected value of dropdown is in the browser and it will not changed untill you close the browser or overwrite it.

 

lets go to next step keep selected after page refresh 

so for it on same page call place a microflow timer widget and call a nanoflow  (after 3 sec or time according to take in page load) once 

 

 

inside nanoflow call another javascript action

now here you will have to target your dropdown / refrensh selector 

you can give a class to you refrence selector and target your select by document.querySelector 

get value that we stored in session 

window.sessionStorage 

and get value by your key name from session of browser 

let sessionItem = sessionStorage.getItem("key");

and afeter it just assign this value of your selected dropdown 

for example 

element  = document.getElementById(“Dropdown”);

element.value = sessionItem;

it will automatically make select option of your dropdown 

 

for window session refrence you can visit 

Window sessionStorage Property (w3schools.com)

I hope It will help you.

answered