Hi,
I have a screen that has a datagrid and a button. On click of button, an editor window gets opened. On click of “Ok” button in the editor window, I want to show a progress bar for 5 seconds and then update and load the datagrid with the saved changes.
In the code below, i have an employee datagrid which will show the employee details. I have a button to add “bonus”. On clicking the button, a dialog box will be opened to add bonus details. On clicking “Ok” button in the dialog window, a progress bar should be displayed for 5 seconds and the datagrid “EmployeeGrid” needs to be updated with the bonus. How can i do that?
screen1.xml
<dataGrid id="EmployeeGrid" width="100%" height="50%" dataContainer="empDc" editorEnabled="true">
<columns>
<column id="empId" property="id" caption="Emp Id"/>
<column id="empName" property="empName" caption="Emp Name" />
<column id="doj" property="doj" caption="Date of Joining" />
<column id="bonus" property="bonus" caption="Bonus"/>
</columns>
</datagrid>
<button id="AddBonus" caption="Add Bonus" />
<progressBar id="progressBar" width="100%" visible="false"/>
controller
@Subscribe("AddBonus")
public void onAddBonusClick(Button.ClickEvent event) {
screenBuilders.editor(Employee.class, this)
.withScreenId("test_Employee.edit")
.withLaunchMode(OpenMode.DIALOG) // open as modal dialog
.build()
.show()
.addAfterCloseListener(e-> {
try {
progressBar.setVisible(true);
// progressBar.wait(5000);
dataContext.commit();
}catch(Exception ex){
ex.printStackTrace();
}
})
;
}