some wrong with Grid because of the attachEvent action

There are some codes I wrote:

dhx.ready(function(){
       dhx.ui.fullScreen();
		dhx.ui({
		rows:[
			{ view:"accordion",
						type:"wide",
                        id:"vertical_accordion",
                        multi:"mixed",
						rows:[
						//1、
												{ header:"需求单查询",id:"cell_a",
													body:		   { 
										view:"form",width:320, id:"searchform", elements:[ 
											{ view:"text", label:"需求单编号:",id:"req_no",inputWidth:300,labelWidth:100},
											{ view:"text", label:"客户姓名:", id:"cust_name",inputWidth:300 }, 
											{ view:"button", label:"搜索", id:"searchButton", type:"form",align:"left",inputWidth: 150,click:"searchInfo" }
										], height:125,
										rules:{
												req_no:dhx.rules.isNotEmpty,
												cust_name:dhx.rules.isNotEmpty
												}
					
								},
										 },
						//2、
							{ 
							
							header:false,id:"cell_b" ,
							body:{
			view:"multiview",id:"multiview",
			cells:[
		// 视图1  grid
				{ view:"grid", id:"mygrid",width:280,
					select:true,
					css: "basicBG",
					fields:[
						{
							id:"req_noValue",
							label:"需求单编号",
							width:140
							
						},
						{
							id:"cust_nameValues",
							width:140,
							label:"客户姓名", 
							type:"custom"
						}
					],
					datatype:"json"
			 	},

				// 视图2 box
				{// we declare all the front-end components in the variable and then we just put it into view object
                container:"box", id:"mybox", 
		            rows:[// specifies layout
                        { 	
                            view:"toolbar", 
                            type:"MainBar",  
                            elements:[
                                { view:"button", label:"返回", id:"backButton",type:"round",width:100,click:"backGrid"},
                                {view:"label",id:"label", align:'center'}
                                //'button'(default value), 'default', 'form', 'round', 'prev' or 'next'
                                
                            ]
                        },
         
                        {
						     //  gravity:2,  // dimensional parameter
	                          view:"multiview", // specifies multiview component
	                          cells:[{ view:"list", id:"order", datatype:"json",scroll:true,
				                             template:"#co_nbr#", select:true, type: { width: 300 }
																   },
							          { view:"list", id:"project", datatype:"json",scroll:true,
											             template:"#prj_task_no#", select:true, type: { width: 300 }
																			   }]
                        }, 
                       { 
                            view:"toolbar",
			                type:"BigTabBar",
                            id:"TopToolbar", 
                            elements:[     // here we specify toolbar control 'tabbar'
                            	{ view:"tabbar", id:'tabbar', selected: 'tab_video', align:"center", inputWidth:300, options: [   
                            	   { label: '订单', src: rootPath+'/images/tabbar/video.png', value: 'order'},
                            	   { label: '项目单', src: rootPath+'/images/tabbar/music.png', value: 'project'}
                            	]}
                                ]
                       }
                       
                    ]
			}
				
			]
		}
							
							}
						]
		},
		

     
		]
		});
		
				dhx.attachEvent("onRotate", fix_layout);
});	
$$('mygrid').attachEvent("onAfterSelect", function(){  //  $$('mygrid')
			
			$$('project').clearAll();	
			$$('order').clearAll();	 
			$$('project').refresh;				   	
		  	$$('order').refresh;				   	

	        $$('label').setValue($$('mygrid').item($$('mygrid').getSelected()).req_noValue+"_"+$$('mygrid').item($$('mygrid').getSelected()).cust_nameValues);
		    $$('order').define("url", urlOrder+"?req_no="+$$('mygrid').item($$('mygrid').getSelected()).req_noValue);  //  并且根据不同的 条件,显示不同的内容。	
			$$('project').define("url", urlProject+"?req_no="+$$('mygrid').item($$('mygrid').getSelected()).req_noValue);  //  并且根据不同的 条件,显示不同的内容。	
			$$('order').refresh;
			$$('project').refresh;
			
		    $$('mybox').show();  // 显示 界面 form 表单 视图1
		    $$("tabbar").show(); // specifies which tab will be showed initially
		    
            $$("TopToolbar").attachEvent("onBeforeTabClick",function(button,id){ 
                                           $$(id).show();
                                         });
		}); */
		$$('mybox').bind('mygrid');  // 表单 myform 绑定 在 视图1  mygrid 上
[img]

[/img]
But the attachEvent action of the grid cann’t work,it($$(‘mygrid’).attachEvent(“onAfterSelect”, function(){ // $$(‘mygrid’)) cann’t turn annother view ! Why? I compare it with the codes of the 03_edit.html of the samples ,I cann’t find the wrongs in my codes ,Please!

In your code there is a next line

                container:"box", id:"mybox", 

why are you using “container” here ? It instructs ui builder to create element in external container instead of multiview, which may lead to the problems.

In the directory of grid ,there is a named 03_edit.html, in this example , I just added

dhx.ready(function(){ dhx.ui.fullScreen(); // here is the codes of the 03_edit.html })
in the example .Consequently, the example cann’t work . Why? Please help me ! Friends , please try it in the example.

I
I delete the “container” , and it also cann’t work ,Please!

$$(‘mygrid’).attachEvent(“onAfterSelect”,function(){…}) should be called after dhx.ui(), it meants - inside ready handler:

dhx.ready(function(){ dhx.ui.fullScreen(); dhx.ui({ .... }); dhx.attachEvent("onRotate", fix_layout); // grid should be called here! $$('mygrid').attachEvent("onAfterSelect", function(){ .... }); });

Thank you very much ,Alexandra ! But I encounter another question ,when I click the row of the grid ,it goes into another view in the 03_edit.html of the grid directory , then I click the button ,it return . This time ,I try to click the the same row ,this moment ,it cann’t work. please !