bohua / nprinting-sense-on-demand

NPrinting On-demand extension for Qlik Sense
MIT License
10 stars 13 forks source link

Request : Conditional Button On-Demand #16

Closed amien90 closed 5 years ago

amien90 commented 6 years ago

Can you make the On-Demand button greyed out if a specific condition is not met? i want to disable the On-Demand button when the selected report contains > 1.000.000 records for example. Just to prevent that end-users click on the on-demand button why accident with too many records selected.

Thanks in advanced

bohua commented 5 years ago

hi @amien90, yes. I will add it.

youtiger commented 5 years ago

Add button: js/properties.js, Line 138

        enabled: {
            ref: "npsod.conn.enabled",
            label: "Enabled",
            type: "string",
            expression: "optional"
        }

Add Enable / Disable watch, nprinting-sense-on-demand.js, Line 540

            $scope.$watch('layout.npsod.conn.enabled',
                    function ( newVal, oldVal ) {
                        if(newVal == 'disabled' || newVal == 'false')
                        {
                            outterObj.find('.npsod-export-btn').attr('disabled','disabled');
                        }
                        else
                        {
                            outterObj.find('.npsod-export-btn').removeAttr('disabled');
                        }
                    }
                );
and29 commented 5 years ago

Hi @amien90 , now it should be possible by adding under 'Appearance->Display->CSS Conditional Class' something like this example: if(GetSelectedCount(Year)=0, 'disabled')

Andrea

amien90 commented 5 years ago

Thanks All