locked
Strange result with Custom Control RRS feed

  • Question

  • Hi,

    I have a list and I want  to format the list so It looks a bit better.

    I followed the examples from tutorials but I get a strange result

    The result: Adress:Undefined

    Help, pleace!

    Sven

    lightSwitchApplication.Besiktningar.prototype.RowTemplate_render = function (element, contentItem) {
        // Write code here. 
        var itemTemplate = $("<div> </div>");
        var adress = $("<h3> Adress: " + contentItem.value.AdressTabell + "</h3>");
        adress.appendTo($(itemTemplate));
        itemTemplate.appendTo($(element));
    };


    SE1969

    Monday, August 6, 2012 6:17 PM

Answers

  • Hi,

    THANKS!!!!

    It worked. I missed Camel casing......

    Now I'm happy again :)

    Thanks again Johan and Michael

    Regards Sven


    SE1969

    • Marked as answer by Sven Elm Wednesday, August 8, 2012 7:10 AM
    Wednesday, August 8, 2012 7:09 AM

All replies

  • Hi Sven,

    Just a guess, but shouldn't "Adress" actually be "Address" (English spelling has 2 D's)?

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    Tuesday, August 7, 2012 5:47 AM
    Moderator
  • Hi,

    It should if you where from the US but I´m from Sweden and we spell it a bit different so thats not the issue. Normally I always use English but in this test Project there som mixing in spellings :)

    Thanks anyway.

    I'm using an attached external sql database for this and can this be a problem you Think ?

    Regards,

    Sven


    SE1969

    Tuesday, August 7, 2012 6:41 AM
  • Hi Sven,

    Well, I tried :-)

    It could be an issue with the attached DB. The HTML Client Preview is pretty fragile, and dealing with anything outside of what we shipped on the VM is untested. The example in the tutorial is pretty much a end-to-end scenario that we verified - what are you trying to do that is different from that exact scenario? And if you follow the tutorial without any changes, does it work?

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    Tuesday, August 7, 2012 6:53 AM
    Moderator
  • Just saw your reply in the other thread here: http://social.msdn.microsoft.com/Forums/en-US/lightswitchhtml/thread/759994eb-35d8-496b-a1b6-cfcc6ca89c17

    Same issue?

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    Tuesday, August 7, 2012 6:55 AM
    Moderator
  • Hi again,

    Could the message mean that the fields format i unknown due to it's a external database?

    Sven


    SE1969

    Tuesday, August 7, 2012 6:58 AM
  • Hi,

    It shouldn't, but it's possible since it's probably untested. We should be able to recognize any standard SQL formats, but it could very well be a bug.

    Regards,


    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    Tuesday, August 7, 2012 7:04 AM
    Moderator
  • I have a date field from the same database that works if I use moment.js with formatting.

    If I do not use moment.js and only writes contentItem.value.Date occurs the same error.

    It works with 'moment(contentItem.value.Date). Format ("YYYY-MM-DD")'

    Strange. Should I use some type of formatting for the summary field or a script like Moment?

    Or is it just a bug? Regards, Sven


    SE1969

    Tuesday, August 7, 2012 7:59 AM
  • I would guess it's a bug, or more accurately just something that wasn't yet implemented in the preview build.

    Steve Hoag Microsoft aka the Lights Witch (IEnumerable of Newt)

    Tuesday, August 7, 2012 3:06 PM
    Moderator
  • I may very well be wrong, but doesn't moment(undefined) do the same as moment(new Date()), which will result in a "moment" corresponding to the current date/time?

    I also assume that what the content item is bound to is an entity, and that there is a field on that entity that is called Date, correct? If so, could you please try to use contentItem.value.date and see if that works... (We are camel casing the field names in the API, so the field/property called Date in the entity designer will be "date" in the API)

    Best regards/med vänliga hälsningar,
    Johan Stenberg


    Development Lead, Visual Studio LightSwitch

    Tuesday, August 7, 2012 10:48 PM
    Moderator
  • On the same note that Johan wrote about camel-casing:  looks like in your original question about the address, "address" needs not only to have two Ds, but also start with a lowercase "a".

    Wednesday, August 8, 2012 12:47 AM
    Moderator
  • Hi,

    THANKS!!!!

    It worked. I missed Camel casing......

    Now I'm happy again :)

    Thanks again Johan and Michael

    Regards Sven


    SE1969

    • Marked as answer by Sven Elm Wednesday, August 8, 2012 7:10 AM
    Wednesday, August 8, 2012 7:09 AM