Discuss issues related to v5.x

Post by mpathella »

Hi Team,

I am bryntum scheduler print functionality. While using it, a Print pop up has been populated with some set of fields and two buttons naming "Print " and "Cancel". I would like to know the triggering point for Cancel. I tried it on your sample examples js file as well. Unfortunately could not trigger at any point. For more details check the attachments that were added to this question.

Attachments
this is the screen of Print popup on scheduler samples.
this is the screen of Print popup on scheduler samples.
MicrosoftTeams-image (8).png (139.43 KiB) Viewed 149 times

Post by arcady »

Unfortunately the button implementation lives in private code.
The dialog is represented w/ a private Sch.widget.ExportDialog class. The class has buildButtons method that looks like this:

    /**
     * Create Dialog's buttons.
     *
     * @param {Object} buttonsScope Scope for the buttons.
     * @return {Object[]} buttons Array containing buttons definition for Exporting/Cancelling export.
     */
    buildButtons : function (buttonsScope) {
        var me = this;

        return [
            Ext.apply({
                xtype   : 'button',
                scale   : 'medium',
                itemId  : 'export',
                text    : me.L('exportButtonText'),
                handler : me.onExportButtonPress,
                scope   : buttonsScope || me
            }, me.exportButtonConfig),
            Ext.apply({
                xtype   : 'button',
                scale   : 'medium',
                itemId  : 'cancel',
                text    : me.L('cancelButtonText'),
                handler : me.onCancelButtonPress,
                scope   : buttonsScope || me
            }, me.cancelButtonConfig)
        ];
    },

As you can see the button has onCancelButtonPress handler looking like this:

    onCancelButtonPress : function () {
        this.destroy();
    },

So you can override that method

Ext.override('MyExportDialog', {
    extend : 'Sch.widget.ExportDialog',

    onCancelButtonPress : function () {
        // some custom code
        this.callParent(arguments();
    }
})

You can then provide to the feature your custom class implementing the dialog: Sch.plugin.Printable#exportDialogClassName.

    plugins: [
        {
            ptype: 'scheduler_printable',
            exportDialogClassName : 'MyExportDialog'
        },

Post by mpathella »

Unfortunately the method which you suggests is not invoked when we added this part of code to our js file. Please have a look on it.

Ext.override('MyExportDialog', {
    extend: 'Sch.widget.ExportDialog',
    onCancelButtonPress: function() {
        // some custom code
        this.callParent();
    }
})

Post by pmiklashevich »

Please use Ext.define instead

Ext.define('MyExportDialog', {
    extend: 'Sch.widget.ExportDialog',
    
onCancelButtonPress: function() { console.log('cancel') this.callParent(arguments); } });
Pavel Miklashevich - Core Developer

Post by mpathella »

We tried the above code , still it is not working.
FYI, we already override below form

Ext.define('PrintExportForm', {
    extend : 'Sch.widget.ExportDialogForm',

alias : 'widget.printForm',

createFields : function () {
    var instance    = this,
        items = instance.callParent(arguments);

    // append one more extra field for user title
    instance.titlefield = Ext.create('Ext.form.field.Text', {
        fieldLabel : 'Export title',
        name       : 'exportTitle',
        value:   <someValue>
    });

    return [instance.titlefield].concat(items);
}
});

Post by mpathella »

Hi team, Please have a look into this info.


Post by arcady »

As far as I see you override Sch.widget.ExportDialogForm which is a form.
But I told you to override Sch.widget.ExportDialog ..which is a window.


Post Reply