Sorry, this still doesn't work
Support Forum
It works fine here. I've attached the app, please check this below and compare it with your app.
- Attachments
-
- advanced examples 2.zip
- (36.33 KiB) Downloaded 39 times
When I add this code, it doesn't work
let data = await window['GanttComponent'].component.reloadData()
This is an HTTP request, because every time I switch people, I have to ask the background to get some information to see if I need to pop up a confirmation box, but when I add the request, the confirmation box will have a problem
async selectionChange(changed) {
console.log(changed);
// let data = await window['GanttComponent'].component.reloadData()
if (changed.action == "select") {
if (count > 0) {
const result = await MessageDialog.confirm({
title: 'The big question',
message: 'Do you really want to select?',
okButton: 'Yes',
cancelButton: 'No'
});
if (result != MessageDialog.okButton) {
this.scrollRowIntoView();
changed.selected.length && this.deselectRow(changed.selected[0]);
// returning to the original person
changed.deselected.length && this.selectRow(changed.deselected[0]);
MessageDialog.close();
}
}
}
if (changed.action == "deselect") {
if (count > 0) {
const result = await MessageDialog.confirm({
title: 'The big question',
message: 'Do you really want to deselect?',
okButton: 'Yes',
cancelButton: 'No'
});
if (result != MessageDialog.okButton) {
this.scrollRowIntoView();
changed.deselected.length && this.selectRow(changed.deselected[0])
changed.selected.length && this.deselectRow(changed.selected[0]);
MessageDialog.close();
}
}
}
}
},
This is an HTTP request method.If I send you the complete demo, you can't call this interface, it will give an error, anyway, this is an HTTP request, you can simulate it, after the HTTP request, you get a Boollen popup, if it is true, it pops up, if it is false, you don't need to pop up
reloadData()
async reloadData() {
let response: any = await this.https.get('https://qakimigatewaybe.schaefflercn.com/pp/gateway/api/app/project-cast/delete-project-member-confirm-info/' + this.projectId + '?userName=' + JSON.parse(localStorage.getItem('userInfo')).user.userName, {}).toPromise();
console.log(response.data)
return response.data
}
Now there is another troublesome problem, you can watch my video, when I switch people, the confirmation box appears, at this time, I click any place outside the box, which is equivalent to clicking confirm
- Attachments
-
- IMG_6301.MOV
- (14.34 MiB) Downloaded 36 times
Hi shimnx,
Looks like it cannot be easily reached and it needs more attention and coding than we thought in the beginning.
I've opened a feature request to add preventable and async beforeSelectionChange
event that will make it easily achievable. https://github.com/bryntum/support/issues/4705
For now, I am afraid, we cannot continue development in bounds of forum support. You could try to hire us by contacting bryntum.com/services and we make a full and complete solution for you, of you need that asap.
As an idea to fix that, try to use beforeFinishCellEdit
event, something like
beforeFinishCellEdit({ editorContext }) {
if (editorContext.column.type === 'resourceassignment') {
MessageDialog.isVisible && MessageDialog.close();
}
}
But I didn't test that and I am pretty sure you will get something else on the next step.
All the best,
Alex
I have two questions now
- Confirm dialog box The confirm dialog box appears again when you click NO
- Confirm that the pop-up box appears and click the blank area to automatically select the designated person
May I ask which problem you mentioned is difficult to solve now? If it is the first one, I think I can accept it for the time being, but the second one has a great impact on us
Looks like it cannot be easily reached and it needs more attention and coding than we thought in the beginning.
I've opened a feature request to add preventable and async beforeSelectionChange
event that will make it easily achievable. https://github.com/bryntum/support/issues/4705
For now, I am afraid, we cannot continue development in bounds of forum support. You could try to hire us by contacting bryntum.com/services and we make a full and complete solution for you, of you need that asap.
As an idea to fix that, try to use beforeFinishCellEdit
event, something like
beforeFinishCellEdit({ editorContext }) {
if (editorContext.column.type === 'resourceassignment') {
MessageDialog.isVisible && MessageDialog.close();
}
}
But I didn't test that and I am pretty sure you will get something else on the next step.
[/quote]
Regarding to #1
You need to debug your code. I saw you have a counter that manage dialog appearance. Maybe you need to change count number in beforeFinishCellEdit
as well. When you closed editor by click outside, it may trigger another selectionChange event. Just put debugger and check.
Regarding to #2
At the moment when you clicked on blank area, the selection is already done. Confirm dialog appears on selectionChange event, it triggered after selection changed, not before. And even if it triggered before, it is sync method. So actually, as you can see in the code, when you click "No" in confirmation dialog, it reverts selection back.
These 2 and other potential problems is caused by using selectionChange event, which is not perfect place to make async confirmation. That's why I opened a feature request to create another event that will allow us to add confirmation dialogs and other async validation. We can't suggest you any other solution before we have feature request done.
You could try to go forward with using that event, but the solution we have for now is not really good and stable to just give you advice here to fix all, we cannot develop a business logic for you in bounds of forum support, unfortunately. We can just show you the way to go, investigate and help with problems in our code and advice you API. As you can see, our API needs in some improvements for such use cases.
All the best,
Alex