Hello, I am having trouble with disabling buttons conditionally:
I have this type of button:
<dot:Button Enabled="{value: PJT.IsEnrichmentJobCreating}" ID="startEnrichmentBtn" ButtonTagName="button"
class="btn btn-success fw-bold"
Click="{command: ConfirmAndStartJob()}">
<span Visible="{value: !PJT.IsEnrichmentJobCreating}">
<i class="fa-solid fa-wand-magic-sparkles me-2"></i>Start Enrichment
</span>
<span Visible="{value: PJT.IsEnrichmentJobCreating}">
<span class="spinner-border spinner-border-sm me-2"></span>Starting…
</span>
</dot:Button>
and I have a javascript event to actually make the button disabled while the viewmodel is running its function:
dotvvm.events.beforePostback.subscribe(function (sender) {
var id = sender.sender ? sender.sender.id : null;
if (id === 'startEnrichmentBtn') dotvvm.viewModels.root.viewModel.PJT().IsEnrichmentJobCreating(true);
});
But instead of actually working, I get this error.
So I’m wondering what is the proper way to disable a button while a function is running on the backend?
Thanks for any answers, this is driving me crazy ![]()
