multiselect动态添加DatePicker选中的日期并显示最近有个需求,需要点击“添加日期按钮”弹出窗口对日期进行
multiselect动态添加DatePicker选中的日期并显示
最近有个需求,需要点击“添加日期按钮”弹出窗口对日期进行添加并将所选日期动态添加到multiselect上并显示,此外还需实现multiselect上单个或全部清除的功能。
???? Ext上multiselect的官方例子都是静态数据的,网上搜了下,这方面的资料也很少,有的话也要用到json数据实现。但是我的需求中multiselect要显示的数据只是几个日期值,可以说是个一维数组而已,不想那么复杂。结合网上稀少的资料,想出了以下方案实现。
先贴以下myMultiselect.js的代码
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="<%=path%>/ext2/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/css/desktop.css" />
<style type="text/css">
* {
font-size: 8pt;
font-family: "Tahoma";
}
</style>
<script type="text/javascript" src="<%=path%>/ext2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="<%=path%>/ext2/ext-all.js"></script>
<!-- multiselect -->
<link rel="stylesheet" type="text/css" href="<%=path%>/js/monitor_time/multiselect.css"/>
<script type="text/javascript" src="<%=path%>/js/monitor_time/DDView.js"></script>
<script type="text/javascript" src="<%=path%>/js/monitor_time/MultiSelect.js"></script>
<script type="text/javascript" src="<%=path%>/js/monitor_time/ItemSelector.js"></script>
<script type="text/javascript" src="<%=path%>/js/monitor_time/myMultiselect.js"></script>
</head>
<body>
</body>
</html>
?
还有multiselect.css,MultiSelect.js,ItemSelector.js,DDView.js也给下
本例子是用Ext2做的,已运行过。