locked
LightSwitch 2013 - adding lightswitch classes after timeout RRS feed

  • Question

  • Hey,

    I'm building a LightSwitch 2013 HTML application.

    when i'm adding an html element to the DOM after timeout, it doesn't get all lightswitch classes that should be added if there wasn't a timout.

    For example:

    settimeout(function(

    $ul = $("<ul></ul>");
    $ul.attr("data-role", "listview");
    $ul.attr("data-filter", "true");

    $(element).append($ul);

    ),100);

    The ul will not get all the classes that lightswitch would give if there was no timeout.

    Any ideas?

    Thanks.

    Monday, February 8, 2016 9:22 AM

Answers

  • This is because the timeout causes your elements to be added after jQuery Mobile processes the page.  Ideally you should eliminate the timeout but you could try to force jQuery to process the elements with this:

    $(element).trigger("create");

    HTH,

    Josh

    • Marked as answer by Yaron Y Monday, February 8, 2016 12:20 PM
    Monday, February 8, 2016 11:51 AM

All replies

  • This is because the timeout causes your elements to be added after jQuery Mobile processes the page.  Ideally you should eliminate the timeout but you could try to force jQuery to process the elements with this:

    $(element).trigger("create");

    HTH,

    Josh

    • Marked as answer by Yaron Y Monday, February 8, 2016 12:20 PM
    Monday, February 8, 2016 11:51 AM
  • A-M-A-I-Z-I-N-G !

    Thanks.

    Monday, February 8, 2016 12:22 PM