今天做了一个点击事件 有一级菜单和二级菜单,下面点击事件是对二级菜单的点击。
panel.on("click","#userStatistics li", function(){
var userStaType = $(this);
if(userStaType.data("type") == "user"){
self.staffTaskStatisticsChart.show();
self.projectTaskStatisticsChart.hide();
self.teamTaskStatisticsChart.hide();
self.getUserStatisticsDataByTask(type, true);
return false;
}else if(userStaType.data("type") == "project"){
self.staffTaskStatisticsChart.hide();
self.projectTaskStatisticsChart.show();
self.teamTaskStatisticsChart.hide();
self.getProjectStatisticsData(type, true);
return false;
}else if(userStaType.data("type") == "team"){
self.staffTaskStatisticsChart.hide();
self.projectTaskStatisticsChart.hide();
self.teamTaskStatisticsChart.show();
self.getTeamStatisticsData(type, true);
return false;
}
}
结果不起作用。
之后改成panel.find("#userStatistics ")on("click","li", function(){
var userStaType = $(this);
if(userStaType.data("type") == "user"){
self.staffTaskStatisticsChart.show();
self.projectTaskStatisticsChart.hide();
self.teamTaskStatisticsChart.hide();
self.getUserStatisticsDataByTask(type, true);
return false;
}else if(userStaType.data("type") == "project"){
self.staffTaskStatisticsChart.hide();
self.projectTaskStatisticsChart.show();
self.teamTaskStatisticsChart.hide();
self.getProjectStatisticsData(type, true);
return false;
}else if(userStaType.data("type") == "team"){
self.staffTaskStatisticsChart.hide();
self.projectTaskStatisticsChart.hide();
self.teamTaskStatisticsChart.show();
self.getTeamStatisticsData(type, true);
return false;
}
}
好了
原因还没找到。