如何从dropdownlist中删除存储在数据库中的项目 [英] How to remove items from dropdownlist which are stored in database
本文介绍了如何从dropdownlist中删除存储在数据库中的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从下拉列表中删除存储在数据库中的特定日期的时间。我使用了两个下拉列表来显示日期和时间。我想只删除已经存储在数据库中的时间。我正在使用SQL数据库。这是为约会管理系统完成的。
How to remove times of a particular date from a dropdownlist which are stored in database. I have used two dropdownlist for date and time. I want to remove only times which are already stored in the database. I am using SQL database. This is to be done for an appointment management system.
推荐答案
1。将所有商品(时间/日期/任何商品)存储在数据库中并将其保存在页面上的json(可能位于隐藏字段中)。
2.删除下拉列表中的项目存在于json列表中。
1. Bring all items (time/date/whatever) stores in database and save it in a json(may be in a hidden field) on the page.
2. Remove the item in drop down which is present in the json list.
(< span class =code-string> option [value ='foo'])。remove();
或更好(如果你几乎没有选择在页面中):
("option[value='foo']").remove(); or better (if you have few selects in the page):
( #select_id选项[value ='foo'])。remove();
("#select_id option[value='foo']").remove();
对于第二步,你实际上必须遍历json并删除下拉列表中的匹配元素。
检查以下关于如何循环json的示例:
For step two, you actually have to loop through the json and remove the matching element in the drop down.
Check the following example on how to loop over json:
var data = [
{"Time": 1PM, },
{"Time": 2PM, },
{"Time": 5PM, }
];
这篇关于如何从dropdownlist中删除存储在数据库中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文