我尝试将表单与网格绑定。我的网格在主要上,我的表单在窗口弹出窗口内。
我的表格代码:
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和表单的名称是相同的。 (该代码适用于我网站的其他部分,但表单不在弹出窗口中。)
问题是:表单似乎没有绑定到网格。
答案 0 :(得分:0)
问题是异步方法:)。表单加载他的结构,直接我尝试绑定网格。现在,我使用表单的doOnLoad,然后我绑定网格。那很有效!