Question

carloregis on Wed, 27 Mar 2013 18:23:17


Hi,

From time to time, I get the error message "no handle for data" in modal picker, when I try to view a database record détails in and Add/Edit screen. The message is rendered directly inside the modal picker control, thus it's become unusable.

Any thoughts ?


Sponsored



Replies

Marco Scholle on Wed, 27 Mar 2013 19:10:18


Hi carloregis,

do you have any code behind? Do you bind a special Datasource to your CB?

Huy Nguyen MSFT on Thu, 28 Mar 2013 04:56:43


Hi,

This is a known bug that will be fixed in the final release of the HTML Client.

Best regards,
Huy Nguyen

carloregis on Thu, 28 Mar 2013 18:12:43


No workaround meanwhile ?

Huy Nguyen MSFT on Thu, 28 Mar 2013 18:21:53


Hi,

Only work-around I can think of is to switch to the full version of msls-1.0.0 library and apply the fix there.

0. Back up msls-1.0.0.js under your project.
1. In Solution Explorer, select the LIGHTSWITCH Application, change the view from Logical View to File View.
2. Under App.HTMLClient, open default.htm. Change msls-1.0.0.min.js into msls-1.0.0.js.
3. Under Scripts, open msls-1.0.0.js.
4. Search for function executeQuery(query) {

I don't have the CTP 4 library ready, so if you can post the content of that function up to operation.code(function success(data) {, I can point out the fix.

Again, this will be fixed in the final release.

Best regards,
Huy Nguyen

NicolasAtProxem on Wed, 03 Apr 2013 09:38:47


Hi,

Here is the code of the function in CTP4 :

function executeQuery(query) {
        msls_mark(msls_codeMarkers.queryDataStart);

        var promise = msls_promiseOperation(function initExecuteQuery(operation) {
            var requestUri = query._requestUri,
                entitySet = query._entitySet;

            OData.read(
                {
                    requestUri: requestUri,
                    recognizeDates: true
                },
                operation.code(function success(data) {
                    msls_mark(msls_codeMarkers.queryDataEnd);

                    var results = [],
                        serverResults = data ?
                            ($.isArray(data.results) ? data.results : [data]) :
                            [],
                        queryExpandTree,
                        totalCount;

                    convertDatesToLocal(serverResults);

                    $.each(serverResults, function (index, result) {
                        if (entitySet) {
                            result = loadEntity(entitySet, result);
                        }
                        results.push(result);
                    });

                    if (results.length > 0) {
                        queryExpandTree = getQueryExpandsTree(query);
                        fixInclusionInQueryResult(results, serverResults, queryExpandTree);
                    }

                    totalCount = data && data.__count;
                    if (!!totalCount && typeof totalCount === "string") {
                        totalCount = parseInt(totalCount, 10);
                        if (totalCount === Number.NaN) {
                            totalCount = -1;
                        }
                    }

                    operation.complete({
                        totalCount: totalCount,
                        results: results
                    });
                    msls_mark(msls_codeMarkers.queryDataApplyEnd);
                }),
                operation.code(function error(err) {
                    msls_mark(msls_codeMarkers.queryDataEnd);

                    var statusCode = tryGetStatusCode(
                            err.response),
                        serverErrors,
                        errorMessages = [];

                    if (statusCode === 404) {
                        operation.complete({
                            totalCount: 0,
                            results: []
                        });

                    } else {
                        serverErrors = tryGetServerErrors(err);
                        if (serverErrors) {
                            errorMessages = serverErrors
                                .map(function (
                                    serverError) {
                                    return serverError.message;
                                });
                        }

                        operation.error(errorMessages.join("\r\n"));
                    }
                })
            );

            operation.interleave();
        });
        return promise;
    }

A fix right now would be of great help.

Best regards,
Nicolas F.


Huy Nguyen MSFT on Wed, 03 Apr 2013 16:16:48


Hi Nicolas,

Remember to follow step 0..4 above, then add this header to the OData.read

            OData.read(
                {
                    requestUri: requestUri,
                    recognizeDates: true,
                    headers: {
                        MinDataServiceVersion: "3.0"
                    }
                },

The final release of HTML Client will contain the same fix.

Best regards,
Huy Nguyen

NicolasAtProxem on Thu, 04 Apr 2013 15:18:57


It works, thank you :-)

Best regards,
Nicolas F.