Jump to content

Recommended Posts

Posted
2 minutes ago, araujoadanr said:

Does anyone know how to use Triggers with ScreenMask?

Hello,

Could you please clarify your question a bit more?

Posted

Sure, thanks a lot for replying.

I have some editors that have triggers (trigger buttons), and when they perform very long operations, I can't get the screen mask to work with a "wait" message, which I usually use with the controls like a normal button.

image.png.ecd61c407162f9804776ad4ed6e7881d.png

Posted

Just to better understand — are you using a filter editor, or editors within the grid cells?

Also, could you give an example of the long-running operations you mentioned?

Posted

Im use filter with mGridFiltering.zipy grid, the filter add in runtime 

Sorry for the delay. I have prepared a test case using the GridFiltering sample from uniGUI\Demos\Desktop\GridFilter.

I have attached a ZIP file containing a video that demonstrates the filtering example for better clarification.

Thank you in advance.

Posted

Hello,

You have some dependencies, and it seems there are third-party components involved, so I couldn’t run your test case.

However, the general idea is clear — when filters are applied, the grid should show a mask during that time, if I understood correctly, right?

Posted

Hello,

3 hours ago, araujoadanr said:

Sorry for Delay, 

Please try again.

Np, try this approach:

UniDBGrid1.ClientEvents.ExtEvents ->

function reconfigure(sender, store, columns) 
{

    if (!sender._cMask) {

        sender._cMask = new Ext.LoadMask({
            target: sender,
            msg: 'Filtering...'
        });

        var store = sender.getStore();

        store.on('load', function () {
            sender._cMask.hide();
        });

        store.on('exception', function () {
            sender._cMask.hide();
        });
    }

    columns.forEach(function (col) {

        if (col.fedit && !col._maskBound) {

            col._maskBound = true;

            col.fedit.on('change', function () {

                sender._cMask.show();

                // safety fallback
                Ext.defer(function () {
                    if (sender._cMask) {
                        sender._cMask.hide();
                    }
                }, 8000);

            });
        }

    });
}

 

Posted

I have this button (trigger) to clear the filters, using the code you provided. I asked AI to add it. Honestly, I'm not a JS expert, but the code works. Would you have any objection?

function reconfigure(sender, store, columns, oldStore, oldColumns, eOpts)
{
    if (!sender._cMask) {
        sender._cMask = new Ext.LoadMask({
            target: sender,
            msg: 'Filtrando...'
        });
    }

    var currentStore = sender.getStore();
    if (!sender._storeBound || (oldStore && oldStore !== currentStore)) {
        if (oldStore && oldStore !== currentStore) {
            oldStore.un('load', sender._onStoreLoad, sender);
            oldStore.un('exception', sender._onStoreException, sender);
        }
        sender._onStoreLoad = function () { sender._cMask.hide(); };
        sender._onStoreException = function () { sender._cMask.hide(); };
        currentStore.on('load', sender._onStoreLoad, sender);
        currentStore.on('exception', sender._onStoreException, sender);
        sender._storeBound = true;
    }

    var showMask = function () {
        if (sender._cMask) {
            sender._cMask.show();
            Ext.defer(function () {
                if (sender._cMask) sender._cMask.hide();
            }, 8000);
        }
    };

    if (columns) {
        columns.forEach(function (col) {

            // fedit change
            if (col.fedit && !col._maskBound) {
                col._maskBound = true;
                col.fedit.on('change', showMask);
            }

            // triggers: usar getTrigger() + el elemento DOM
            if (col.fedit && !col._triggerBound) {
                col._triggerBound = true;
                ['t1', 't2'].forEach(function (tid) {
                    var trig = col.fedit.getTrigger(tid);
                    if (trig && trig.el) {
                        trig.el.on('click', showMask);
                    }
                });
            }

        });
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...