我尝试用网格绑定表单。我的网格在主屏幕上,我的表单在弹出窗口中。
我的表单代码:
var window_1 = windows.createWindow('window_1', 0, 0, 385, 340);
window_1.setText('Modifier une absence');
window_1.denyMove();
window_1.setModal(1);
window_1.centerOnScreen();
window_1.denyResize();
window_1.denyPark();
window_1.button("minmax").hide();
window_1.button("park").hide();
window_1.button("close").disable();
form_window = window_1.attachForm();
form_window.loadStruct('./data/formAddAbsence.xml');
form_window.bind(grid_3);// to link the form to the grid
form_window.attachEvent("onButtonClick", function(name, command){
if(name=="buttonEnregistrer"){
this.send("editEmployee");
sidebar.cells('sidebar_item_1').setActive(true);
window_1.close();
}
if(name=="buttonAnnuler"){
sidebar.cells('sidebar_item_1').setActive(true);
window_1.close();
}
});
grid_3之前定义为:
var grid_3 = sidebar.cells('sidebar_item_1').attachGrid();
grid_3.setIconsPath('./codebase/imgs/');
grid_3.setHeader(["Nom","Prénom","Statut","Équipe","Début","Fin","Motif"]);
grid_3.setColumnIds("nom,prénom,statut,team,startDate,endDate,type");
grid_3.setColTypes("ro,ro,ro,ro,ro,ro,ro");
grid_3.setColSorting('str,str,str,str,str,str,str');
grid_3.setInitWidths('*,*,*,*,*,*,*');
grid_3.init();
grid_3.sync(absencesDataStore);
网格的id和表单的名称是相同的。(代码在我网站的其他部分有效,但表单不在弹出窗口中)。
问题是:表单似乎没有绑定到网格。
问题在于异步方法:)。表单加载了他的结构,我直接尝试与网格绑定。现在,我使用表单的doOnLoad,然后与网格绑定。真管用!