none
HTML Client - Image on detail screen not showing if record is accessed via deep linking

    Question

  • I have a detail screen that has a local screen property of type string.  The control type for the property is set to image.  The string property is set in code in the Created method to a url where the image is stored.  The url string is comprised of a base url (http://www.myimagedomain/myimages/) + EmployeeID property of Employee entity, + .jpg.  The images are named by the corresponding EmployeeID.  This all works great if I start out on the Browse Employees screen, find a record, tap to view details; the image and details show up as expected.  However, if I try to open the same details screen via deep linking, I get the details, but the image shows blank -- totally blank, not the "not a valid image" message.  Any ideas?  The image only fails when opening the record from a deep link.  Thanks?
    Tuesday, February 18, 2014 7:12 PM

Answers

  • Unfortunately this is a bug that the created method isn't getting called when going through deep linking.  We will be addressing this issue in a future release.  The workaround is indeed to put whatever code that you had in the created method into a postRender method on one of the screen's controls.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Tuesday, March 4, 2014 4:18 PM
    Moderator

All replies

  • Anyone else experience this?
    Wednesday, February 19, 2014 4:43 AM
  • Hi Hessc

    Could you provide me with your scenario below?  we will reproduce it on our side.

    In addtion, you could also follow Dave's blog below to collect some trace to troubleshoot.

    Crank Up Your Visual Studio Build Output to 11

    Best regards

    Angie Xu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, February 24, 2014 6:26 AM
    Moderator
  • Hi Hessc,

    I have the same problem because I'm changing the screen display name into one of the entity properties (let's say 'Description') in myapp.MyScreen.created event, and found debugging that a breakpoint in created event is never hit when the entity default screen gets called by deep linking.

    Does anyone can explain this ?

    Maybe, as a workaround, you could change your image control into a Text control and build your url in javascript. Something like this:

    myapp.MyEntityView.MyImage_postRender = function (element, contentItem) {
        element.innerHTML = "<img src='Content/myimages/" + screen.Employee.Id + ".jpg' />";
    };

    (please check syntax, I'm typing the snippet manually)

    Edit :

    Sorry, please look at this answer for a better image control definition.


    Tuesday, March 4, 2014 8:16 AM
  • Unfortunately this is a bug that the created method isn't getting called when going through deep linking.  We will be addressing this issue in a future release.  The workaround is indeed to put whatever code that you had in the created method into a postRender method on one of the screen's controls.

    David Kidder | Senior SDET | Microsoft | LightSwitch

    Tuesday, March 4, 2014 4:18 PM
    Moderator
  • I tried this quick edit to msls-2.5.0.js and it seems to work but no guarantees :) But there is another deep linking problem - the history stack gives 'error loading screen' when navigating back to the deep linked screen:

    EDIT: Fixed as long as there is a 'key' uri suffix -> .../[abcef0123] for deep link :) so my bad.

        function _prepareNavigationUnit(me, loadOptions) {
    
            var
            options = $.extend({}, _prepareNavigationUnit.defaults, loadOptions),
            showAsDialog = !!options.popup,
            isShowTab = !!options.isShowTab,
            _ScreenType,
            screenObject,
            pageModelId,
            pageModel,
            boundaryOption = options.boundaryOption;
    
            msls_mark(msls_codeMarkers.loadScreenStart);
    
            if (options.screen) {
                _ScreenType = window.msls.application[options.screen.details._modelId];
                screenObject = options.screen;
            } else {


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.


    • Edited by Xpert360 Wednesday, March 5, 2014 12:48 PM Update
    Wednesday, March 5, 2014 12:29 PM
  • Thanks everyone for the responses.  Does anyone have sample postrender code for an image url?  I tried using the code I used in the created method (and many variations of it) and it doesn't work.  I'm sure that I am just using a bad syntax for the PR method.

    Thanks

    Monday, March 10, 2014 5:42 PM
  • That one line edit has been working great for me and that means you can leave your code in the created methods. When it is officially fixed your code will continue working with the next msls-n.n.n file.

    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Monday, March 10, 2014 5:47 PM
  • @Dave Baker.  That is a great point.  I will definitely give it a try.  Thanks.
    Monday, March 10, 2014 10:53 PM
  • Here is another 'fix' in msls-2.5.0.js related to navigation and a crash in an anonymous function for some screens:

        function ArrayIterator(array) {
            this._array = array;
            this._length = (array ? array.length: 0);
            this._index = -1;
        }
    
    This crash happens when users navigate forwards to some screens...


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Thursday, March 13, 2014 2:43 PM
  • Dave, if you have a consistent repro of the problem you are seeing when you navigate forward, can you please send me the details?

    david (dot) kidder (at) microsoft (dot) com

    Thanks


    David Kidder | Senior SDET | Microsoft | LightSwitch

    Thursday, March 13, 2014 3:47 PM
    Moderator
  • Hi Dave, hopefully you received a zip by email. If it did not get through then let me know, thx.

    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Thursday, March 13, 2014 5:49 PM