ExtJS 4.2.0 树节点点击事件

 1 /*
 2  * 取得左侧区域
 3  * 树状导航
 4  * */
 5 var get_viewport_west = function()
 6 {
 7     
 8     consoleLog('2013 0413 1219') ; 
 9     
10 
11     // 节点数据
12     var store = Ext.create('Ext.data.TreeStore', {
13         root: {
14             expanded: true,
15             children : get_tree_nodes() ,
16         }
17     });
18 
19     
20     // 节点点击事件
21     function tree_itemclick( node, event )  
22     {  
23         //var id = event.data.id ;  
24 
25         consoleLog( event.data );
26         
27     };  
28 
29 
30     // 树面板
31     var tree_panel = Ext.create('Ext.tree.Panel', {
32         region: 'west' ,
33         title: 'Simple Tree',
34          200,
35         height: 150,
36         //store: get_tree_store() ,
37         store: store ,
38         rootVisible: false,
39         //renderTo: Ext.getBody(),
40         renderTo: 'viewport_region_west' ,        
41 
42         listeners:{ itemclick : tree_itemclick }
43                 
44     });
45 
46     consoleLog( '2013-04-13 1321 ' );
47 
48     
49     return tree_panel ;
50     
51 };
  1 var get_tree_nodes = function(){
  2     
  3     var nodes = [
  4 
  5 
  6 
  7 
  8                  {
  9                      "text": "1 - 卡口监控", 
 10                      "cls": "folder",
 11                      "expanded": true,
 12                      "children": [
 13                      
 14                          {
 15                              "id": "1.1",
 16                              "text": "1.1 卡口监控数据",
 17                              "leaf": true,
 18                              
 19                              "qtip": "../surveil_data/main.jsp",
 20                              
 21                          }
 22                      ] 
 23                  }, 
 24                  
 25                  
 26                  
 27 
 28                  {
 29                      "text": "2 - 流量统计", 
 30                      "cls": "folder",
 31                      "expanded": true,
 32                      "children": [
 33                      
 34                      
 35                          {
 36                              "id": "2.1",
 37                              "text": "2.1 车流量时统计",
 38                              "leaf": true,
 39                              
 40                              "qtip": "../report/hourly.jsp",
 41                              
 42                          },
 43                          
 44                          {
 45                              "id": "2.2",
 46                              "text": "2.2 车流量日统计",
 47                              "leaf": true,
 48                              
 49                              "qtip": "../report/hourly.jsp",
 50                              
 51                          },
 52                          
 53                          {
 54                              "id": "2.3",
 55                              "text": "2.3 车流量周统计",
 56                              "leaf": true,
 57 
 58                              "qtip": "../report/hourly.jsp",
 59                              "杨": "力权",
 60                              
 61                          },
 62                          
 63                          {
 64                              "id": "2.4",
 65                              "text": "2.4 车流量月统计",
 66                              "leaf": true,
 67                              
 68                              "qtip": "../report/hourly.jsp",
 69                              
 70                          },
 71                          
 72                          {
 73                              "id": "2.5",
 74                              "text": "2.5 车流量年统计",
 75                              "leaf": true,
 76                              
 77                              "qtip": "../report/hourly.jsp",
 78                              
 79                          }
 80                      
 81                      ]
 82                  },
 83                  
 84                  
 85                  
 86                  
 87                  
 88                  
 89                  
 90                  
 91 
 92              {
 93                  "text": "3 - 车辆布控", 
 94                  "cls": "folder",
 95                  "expanded": true,
 96                  "children": [
 97                  
 98                  {
 99                      "id": "3.1",
100                      "text": "3.1 布控车辆监视(全部)",
101                      "leaf": true,
102                      
103                      "qtip": "../monitor/monitoring.jsp",
104                      
105                  },
106                  
107                  {
108                      "id": "3.2",
109                      "text": "3.2 黑名单车辆监视",
110                      "leaf": true,
111                      
112                      "qtip": "../monitor/monitoring.jsp",
113                      
114                  },
115                  
116                  {
117                      "id": "3.3",
118                      "text": "3.3 临时布控车辆监视",
119                      "leaf": true,
120                      
121                      "qtip": "../monitor/monitoring.jsp",
122                      
123                  },
124                  
125                  {
126                      "id": "3.4",
127                      "text": "3.4 红眼客车监视",
128                      "leaf": true,
129                      
130                      "qtip": "../monitor/monitoring.jsp",
131                      
132                  },
133                  
134                  {
135                      "id": "3.5",
136                      "text": "3.5 危化车辆监视",
137                      "leaf": true,
138                      
139                      "qtip": "../monitor/monitoring.jsp",
140                      
141                  },
142                  
143                  {
144                      "id": "3.6",
145                      "text": "3.6 重点车辆监视",
146                      "leaf": true,
147                      
148                      "qtip": "../monitor/monitoring.jsp",
149                      
150                  },
151                  {
152                      "id": "3.7",
153                      "text": "3.7 布控规则管理",
154                      "leaf": true,
155                      
156                      "qtip": "../monitor/rules.jsp",
157                      
158                  }
159                  
160                  ]
161              },
162 
163 
164 
165              {
166                  "text": "4 - 违法处理", 
167                  "cls": "folder",
168                  "expanded": true,
169                  "children": [
170                  
171                      {
172                          "id": "4.1",
173                          "text": "4.1 瞬时超速处理",
174                          "leaf": true,
175                          
176                          "qtip": "../deal_with/over_speed.jsp",
177                          
178                      },
179                  
180                      {
181                          "id": "4.2",
182                          "text": "4.2 区间超速处理",
183                          "leaf": true,
184                          
185                          "qtip": "../deal_with/over_speed_segment.jsp",
186                          
187                      },
188                  
189                      {
190                          "id": "4.3",
191                          "text": "4.3 违规压线处理",
192                          "leaf": true,
193                          
194                          "qtip": "../deal_with/trample_boundary.jsp",
195                          
196                      },
197                  
198                      {
199                          "id": "4.4",
200                          "text": "4.4 违规禁行处理",
201                          "leaf": true,
202                          
203                          "qtip": "../deal_with/forbidding.jsp",
204                          
205                      },
206                  
207                      {
208                          "id": "4.5",
209                          "text": "4.5 违规套牌处理",
210                          "leaf": true,
211                          
212                          "qtip": "../deal_with/fake_plate.jsp",
213                          
214                      },
215                  
216                      {
217                          "id": "4.6",
218                          "text": "4.6 其它违规处理",
219                          "leaf": true,
220                          
221                          "qtip": "../deal_with/other_violation.jsp",
222                          
223                      },
224                  
225                      {
226                          "id": "4.7",
227                          "text": "4.7 信息审核",
228                          "leaf": true,
229                          
230                          "qtip": "../deal_with/audit.jsp",
231                          
232                      }
233                  
234                  ]
235              },
236 
237 
238 
239              {
240                  "text": "9 - 基础数据", 
241                  "cls": "folder",
242                  "expanded": false,
243                  "children": [
244                  {
245                      "id": "9-1",
246                      "text": "9-1 监控设备管理",
247                      "leaf": true,
248                      "checked": true,
249                      "qtip": "../gather/grid.jsp",
250                      
251                  },
252                  {
253                      "id": "9-2",
254                      "text": "9-2 路段管理",
255                      "leaf": true,
256                      "checked": true,
257                      "qtip": "../gather/grid.jsp",
258                      
259                  },
260                  {
261                      "id": "9-3",
262                      "text": "9-3 违法行为管理",
263                      "leaf": true,
264                      "checked": true,
265                      "qtip": "../gather/grid.jsp",
266                      
267                  },
268                  
269                  {
270                      "id": "9-4",
271                      "text": "9-4 红眼车辆管理",
272                      "leaf": true,
273                      "checked": true,
274                      "qtip": "../basic/special.jsp",
275                      "description": "红眼车辆 = 特别车辆(special)",
276                      
277                  },
278                  
279                  {
280                      "id": "9-5",
281                      "text": "9-5 红眼类别管理",
282                      "leaf": true,
283                      "checked": true,
284                      "qtip": "../basic/special_category.jsp",
285                      "description": "红眼车辆 = 特别车辆(special)",
286                      
287                  }
288                  
289                  ]
290              },
291 
292              {
293                  "text": "5 - 系统设置", 
294                  "cls": "folder",
295                  "expanded": false,
296                  "children": [
297                  
298                  {
299                      "id": "5-1",
300                      "text": "5-1 系统参数设置",
301                      "leaf": true,
302                      "checked": true,
303                      "qtip": "../gather/grid.jsp",
304                      
305                  },
306                  
307                  {
308                      "id": "5-2",
309                      "text": "5-2 用户管理",
310                      "leaf": true,
311                      "checked": true,
312                      "qtip": "../gather/grid.jsp",
313                      
314                  },
315                  
316                  {
317                      "id": "5-3",
318                      "text": "5-3 角色管理",
319                      "leaf": true,
320                      "checked": true,
321                      "qtip": "../gather/grid.jsp",
322                      
323                  },
324                  {
325                      "id": "5-4",
326                      "text": "5-4 权限设置",
327                      "leaf": true,
328                      "checked": true,
329                      "qtip": "../gather/grid.jsp",
330                      
331                  },
332                  {
333                      "id": "5-5",
334                      "text": "5-5 功能导航",
335                      "leaf": true,
336                      "checked": true,
337                      "qtip": "../system/navigation.jsp",
338                      
339                  },
340                  {
341                      "id": "5-6",
342                      "text": "5-6 短信模板",
343                      "leaf": true,
344                      "checked": true,
345                      "qtip": "../system_config/short_message_template.jsp",
346                      
347                  }
348                  
349                  ]
350              },
351 
352              {
353                  "text": "6 - 外部数据", 
354                  "cls": "folder",
355                  "expanded": false,
356                  "children": [
357                  
358                  {
359                      "id": "6-1",
360                      "text": "6-1 车辆信息",
361                      "leaf": true,
362                      "checked": true,
363                      "qtip": "../vio_platform_buffer/vehicle_info.jsp",
364                      
365                  },
366                  
367                  {
368                      "id": "6-2",
369                      "text": "6-2 违规行为信息",
370                      "leaf": true,
371                      "checked": true,
372                      "qtip": "../gather/grid.jsp",
373                      
374                  },
375                  
376                  {
377                      "id": "6-3",
378                      "text": "6-3 道路信息",
379                      "leaf": true,
380                      "checked": true,
381                      "qtip": "../gather/grid.jsp",
382                      
383                  }
384                  
385                  ]
386              },
387 
388              {
389                  "text": "7 - 统计报表", 
390                  "cls": "folder",
391                  "expanded": false,
392                  "children": [
393                  
394                  
395                  
396                  {
397                      "id": "7-1",
398                      "text": "7-1 规律性车辆详情",
399                      "leaf": true,
400                      "checked": true,
401                      "qtip": "../deliver/regularity_vehicle_detail.jsp",
402                      
403                  }
404                  
405                  ]
406              },
407 
408 
409 
410 
411 
412 
413 
414              {
415                  "text": "8 - 系统日志", 
416                  "cls": "folder",
417                  "expanded": false,
418                  "children": [
419                  
420                  {
421                      "id": "8-1",
422                      "text": "8-1 用户登录日志",
423                      "leaf": true,
424                      "checked": true,
425                      "qtip": "../report/hourly.jsp",
426                      
427                  },
428                  
429                  {
430                      "id": "8-2",
431                      "text": "8-2 违规审核日志",
432                      "leaf": true,
433                      "checked": true,
434                      "qtip": "../report/daily.jsp",
435                      
436                  },
437                  
438                  {
439                      "id": "8-3",
440                      "text": "8-3 违规上传日志",
441                      "leaf": true,
442                      "checked": true,
443                      "qtip": "../report/weekly.jsp",
444                      
445                  },
446                  
447                  {
448                      "id": "8-4",
449                      "text": "8-4 短信发送日志",
450                      "leaf": true,
451                      "checked": true,
452                      "qtip": "../report/monthly.jsp",
453                      
454                  }
455                  
456                  ]
457              }
458 
459              ];
460     
461     
462     
463     return nodes ;
464     
465     
466 };

原文地址:https://www.cnblogs.com/livon/p/3018428.html