パネルにロードマスクを正しく設定するのに問題があります。ボタンをクリックした後、新しいツリーストアが(ローカルで)生成されており、かなりの時間がかかります。ロードマスクは、関数全体が評価された後(私は思う)にのみミリ秒表示されます。私のコードconsole.log(0)
でconsole.log(1)
は、関数全体が処理された後、ボタンだけが数秒間フリーズしてからフリーズを解除し、その後コンソールにが表示されます0 and 1
。この種の状況を処理する適切な方法は何ですか。コードは次のとおりです。
ボタンの定義:
xtype:'button',
text:'Rozdziel działki',
iconCls:'icon-map_link',
scope:this,
handler:function(){
console.log(0);
this.splitParcels();
}
分割区画機能:-
splitParcels:function(){ var mask = new Ext.LoadMask(Ext.getBody()、{msg: "お待ちください..."}); mask.show(); console.log(1); this.mgstore.getRootNode()。removeAll(); console.log(this.response); var root_node = this.mgstore.getRootNode(); Ext.each(this.response.plans、function(plan){ var plan_obj = { id:plan.plan.id、 text:plan.plan.abbreviation、 gsip_plan:plan、 gsip_type:'plan'、 iconCls:'icon-map'、 拡張:true、 葉:false }; Ext.each(plan.parcels、function(parcel){ var parcel_obj = { id:parcel.parcel.id、 text:parcel.parcel.name、 葉:真、 gsip_plan:plan、 gsip_parcels:parcel、 gsip_type:'parcel'、 iconCls:'icon-vector' }; var planNode = root_node.appendChild(plan_obj); planNode.appendChild(parcel_obj); }); }); if(mask!= undefined)mask.hide(); }