Home › Forums › Guriddo jqGrid JS › Help › Dynamically Populate Select Dropdown
In advance, I would like to thank you for your awesome plug-in.
Dear OlegK,
It works. Thank you
Best regards
Candra
Dear OlegK,
I found a new problem: when I implement dynamic category select drop down, the sub category works well, but when I push refresh/reset/clear filter, the sub category select cann`t return the original select. What should I do?
Could you help me please?
Best regards,
Candra
Hello Candra,
I am not sure, but do you tried to reset the filter inside of dataInit?
Best regards
Oleg
Dear OlegK,
I am sorry I dont understand what you mean with reset the filter inside of dataInit. I dont know how to do it, please give me a guide
Best Regards,
Candra
Hello Candra,
It seems to me I understand now what you need. Try to change the code of the fn function to
function(e) {
Dear OlegK,
Thank you for your fast responce but that can not solve the problem. It only works when we change the value of select dropdown.
If I push the reset toolbar search, only the grid can reload but not the select value. The select value can be reloaded by refreshing the web page.
let say our country select consist of: USA, Australia and our city select consist of: NewYork, Washington, Brisbane, Perth.
If I choose Australia, the sub category select will consist of Brisbane and Perth only.
And then I want to clear my toolbar search to return original value of country select and city select.
I think it should use ajax to reset select toolbar value. How to make it works?
Best Regards,
Candra
Hello Candra,
You wrote “I push the reset toolbar search”. What do you mean? Which JavaScript code you use for it? If you select “All” in the first select ('country') the second select will be reset.
Best regards
Oleg
Dear OlegK,
Sorry for misunderstanding.
I mean the reset toolbar search is the sixth button of six jqgrid navigation buttons on pager which looks like recycled icon. They are:
1) Add New Row,
2) Edit Selected Row,
3) View Selected Row,
4) Delete Selected Row,
5) Find Records, and
6) Reload Grid
Best Regards,
Candra
Hello Candra,
Thank you for explanation. Now it's clear what you mean. Probably some seaching parameters are need be reseted before staring grid reload. I recommend you to look at this old answer which describe how search criteria (filter) can be cleared. You can do this for example inside your custom beforeRefresh event handler. I hope it will work.
I have currently no working example which dynymicylly populate select dropdown list and work per ajax. Another example which implement the same locally you can find here. I hope it could help you a litle.
Best regards
Oleg
Dear OlegK,
I have not succeeded yet to do your guide.
I see that if I change country of select dropdown to 'All', the city of select dropdown will return to original value ( get all cities).
I have an idea to insert your change event function into reset jqgrid section:
jQuery(“#list”).jqGrid('navButtonAdd',”#pager”,{caption:”Reset”,title:”Reset Filter”,buttonicon :'ui-icon-refresh',
Hello Candra,
Happy New Year!
You say that if you select 'All' in the
Dear OlegK,
Happy New Year too guys.
Yes, that works. awesome
but I found a new problem here.
If I choose USA of country select dropdown, the city select dropdown should consist of New York and Washington.
From here, I cann`t use multiple search. If I choose New York of city select dropdown, the contry select dropdown will change to 'All'.
How to keep the value of country select dropdown just like the original multiple search from jqgrid demo?
Thank you OlegK, you have spent a lot of your time for me.
Best Regards,
Candra
Dear OlegK,
could you help me, please? Don`t leave me here
Candra
Hello Candra,
Sorry, but I am just a user of jqGrid. I started with JavaScript development and with jqGrid about 1,5 year ago for one project. Because I studied JavaScript and jqGrid quickly and in the next project (like in all before) I don't need it, I started to answer to the question of other people mostly to keep and to expand my current knowledge in JavaScript and jqGrid. Slowly it becomes my hobby to help other people to use jqGrid. I answer on different jqGrid question in
Hello Candra!
One more question: do you use recreateForm:true option? If you yet, try it. Probably it is just you problem. By the way I set the
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top