Our flexible Kanban board for managing tasks with drag drop


Post by shimnx »

I want to add Radio to MessageDialog, I try to set contentElement and content, but it doesn't work, this is my code, please ask how to use it

 const result = await MessageDialog.prompt({
        title: 'information',
        message: `Please confirm moving ${taskRecords.map(t => `"${t.name}"`).join(', ')} to ${targetColumn.text}?`,
        okButton: 'Confirm',
        content:`<div>111</div>`,
        cancelButton: 'Cancel'
      });
Attachments
屏幕截图 2023-02-22 095543.png
屏幕截图 2023-02-22 095543.png (16.49 KiB) Viewed 645 times

Post by alex.l »

Hi,

https://bryntum.com/products/gantt/docs/api/Core/widget/MessageDialog is a subclass of Popup with pre-defined set of widget in it.

If you want to implement own set of elements, better to use https://bryntum.com/products/gantt/docs/api/Core/widget/Popup
with own https://bryntum.com/products/gantt/docs/api/Core/widget/Popup#config-items

All the best,
Alex


Post by shimnx »

I need my method to be synchronous, but how does Popup make it synchronous because I need the user to return when they click the confirm button

 async beforeTaskDrop({ taskRecords, targetColumn, targetSwimlane }) {
  const result = await MessageDialog.prompt({
        title: 'information',
        message: `Please confirm moving ${taskRecords.map(t => `"${t.name}"`).join(', ')} to ${targetColumn.text}?`,
        okButton: 'Confirm',
        content:`<div>111</div>`,
        cancelButton: 'Cancel'
      });
 	if (result === MessageDialog.okButton) {
     		return true
            } 
 }

Post by alex.l »

no, Popup is not async by default. But you can easily implement it by your own, all you need is create a JavaScript Promise, resolve/reject it inside ok/cancel methods of your button, and add await instruction in your code.

All the best,
Alex


Post by shimnx »

Can the MessageDialog add components? radio, for example, still uses bryntum components rather than customizations

items    : [
        {
            tag   : 'p',
            style : 'font-weight:500',
            html  : 'Do you need jQuery in your web app?'
        },
        {
            type         : 'radio',
            name         : 'radios',
            text         : 'No',
            checked      : true,
            checkedValue : 'A'
        },
        {
            type         : 'radio',
            name         : 'radios',
            text         : 'Probably not',
            checkedValue : 'B'
        },
        {
            type         : 'radio',
            name         : 'radios',
            checked      : true,
            text         : 'Unlikely',
            checkedValue : 'C'
        }
    ]

Post by alex.l »

Hi,

As I said before, MessageDialog is a Popup with pre-defined set of widgets in it. You need to use Popup class with desired items.

All the best,
Alex


Post Reply