1.根据下拉框选择要显示的列
html:<input id="AirFactorMultiselect" name="factor" class="easyui-combotree" data-options="onChange:factorOnSelect" style="width:130px">
javascript:
///因子切换
function factorOnSelect(nv, ov) {
if (data != "" && data != null && data != undefined) {
var all = ["PM10", "PM25", "SO2", "NO2", "CO", "O3"];
$.each(all, function (lx, obj) {
dg.datagrid('hideColumn', obj);
});
$.each(nv, function (lx, obj) {
if (obj != 'all') {
dg.datagrid('showColumn', obj).datagrid('autoSizeColumn', obj);
}
});
}
}
2.发现AQI不受影响
修改var all = ["PM10", "PM25", "SO2", "NO2", "CO", "O3"];
为:var all = ["AQI", "PM10", "PM25", "SO2", "NO2", "CO", "O3"];(要和页面上因子下拉框里的顺序保持一致)