简体   繁体   中英

Large amount of static values in linked selects! - ASP.NET MVC

I have a conceptual problem.

For an ASP.NET MVC / C# website (although the exact technology may not be that important) I have 2 linked drop downs (html select) with Countries and Cities of a continent.

These are currently kept in 2 database tables and as you imagine the Cities table has round 10 000 records.

The current functionality is: - initially the country select is populated. - the user selects a country, an ajax request goes to the server, retrieves the cities for that country_id and populates the second (cities) select.

Sometimes it gets a bit slow as you might imagine, and since these are in the end static values (the lists will not change) what will be the best way to treat this situation?

我建议使用jquery选择的插件Chosen插件(可用于过滤结果)来实现它,但是由于收到的响应如此之大,因此可以将搜索过滤器功能与ajax合并,如下所示, Jquery Ajax-Chosen

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM