显示年份的下拉框
<input id="ss" class="easyui-combobox" style="width: 70px;"></input>
javaScript代码
//加载年份
$(function() {
//年份
var date = new Date();
var yearObj = $("#ss");
//获取当前年份
var currentYear = date.getFullYear();
//默认值
var defaultVal = currentYear;
yearObj.html("");
var json = [];
for (var i = currentYear - 5; i <= currentYear + 10; i++) {
json.push({
"id" : i,
"text" : i + ""
});
}
$("#ss").combobox(
{
valueField : 'id',
textField : 'text',
value : defaultVal,
onChange : function(newValue, oldValue)
{//选中年份值改变触发
$("#dg").datagrid(
'reload',
ctx + "/system/listHolidayBySelect?year="+ newValue);//加载选中年份的数据
},
height : 30,
panelHeight : json.length >= 7 ? "280px" : "auto"
}).combobox("loadData", json);
});