Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Referencing clientContext/internalClientContext

$
0
0
In http://forums.smartclient.com/showthread.php?t=29681&page=3

I found that in more recent 8.3 builds clientContext had been renamed internalClientContext.

I was told "Your code should not be referencing clientContext unless you actually create one, so you should correct your code, then update" so I'm wondering how I should be doing things instead.

Currently we reference this in the validateData and transformResponse functions of RestDataSources e.g...

Code:

validateData: function (values, callback, requestProperties) {
            // Force showPrompt when validating....
            var bShowPrompt = true;
            if (requestProperties
                && requestProperties.internalClientContext
                && requestProperties.internalClientContext.component
                && requestProperties.internalClientContext.fieldName) {

                // If a grid boolean field is set with canToggle (the default) and the user clicks the checkbox without
                // going into into an inplace edit smartclient calls validateData on all fields, calls RPCManager.doShowPrompt (which
                // shows our busy mouse cursor) but then doesn't actually send a validate to the server and doesn't call doClearPrompt and
                // therefore our mouse cursor doesn't get reset.
                // This is an attempt to try to detect that scenario and not switch on the prompt.
                var component = requestProperties.internalClientContext.component;

                if (isc.isA.ListGrid(component)) {
                    var field = component.getAllField(requestProperties.internalClientContext.fieldName);

                    if (field.canEdit === false)
                        bShowPrompt = false;
                }
            }

            requestProperties.showPrompt = bShowPrompt;

I haven't checked if this logic is needed with 9.1 but if so is there a different way we should be interrogating the fields within a RestDataSource request or response?

Thanks,

Dan

Viewing all articles
Browse latest Browse all 4756

Trending Articles