Results 1 to 16 of 16
  1.    #1  
    So I'm working on including a list widget in my app, but all I can get it to display is the title for the list, no data.

    I've mirrored the list widget setup from webOS Rough Cuts, and the beginning of the widget-list.jsjsjs $file$ $from$ $share$\$framework$\$javascripts$, $but$ $I$ $can$'$t$ $seem$ $to$ $get$ $it$ $to$ $work$.

    If I run the palm inspector and I get the following error message:
    Error: Caught exception in List widget 'mylist' setup(): TypeError: Cannot read property 'parentNode' of null

    Is anyone else experiencing this? Does anyone have any tips?
  2. #2  
    Do you have your templates set up correctly?
  3. #3  
    I have been having some similar issues... only the error is less descriptive in Safari. I did some old-school console logging/debugging and narrowed it down to the following code in javascripts/widget_list.jsjsjs:

    Code:
    // Apply formatters here instead of in render(), so that we can also add the 'listElements' property to the decorator.
    var obj = Mojo.Model.format(this.controller.model, this.controller.attributes.formatters);  
    obj.listElements = "<div id='MojoListItemsParentMarker'></div>";
    this.contentDiv.innerHTML = Mojo.View.render({object: obj, template: this.listTemplate});
    
    // Find the list items parent, insert the items, and then mark them with their index into the data object array:
    placeholder = this.contentDiv.querySelector('#MojoListItemsParentMarker');
    What I'm seeing is that 'placeholder' is null for some reason even though we just added it to the DOM. Strange thing though, it only happens in my app and not in the UIWidgets app.
  4. #4  
    You guys resolve this issue? I'm having the same exact thing happen to me and it's driving me nuts.
  5. #5  
    Nope... no resolution yet.
  6. dlord369's Avatar
    Posts
    15 Posts
    Global Posts
    28 Global Posts
    #6  
    Quote Originally Posted by bourds View Post
    I have been having some similar issues... only the error is less descriptive in Safari. I did some old-school console logging/debugging and narrowed it down to the following code in javascripts/widget_list.jsjsjs:

    Code:
    // Apply formatters here instead of in render(), so that we can also add the 'listElements' property to the decorator.
    var obj = Mojo.Model.format(this.controller.model, this.controller.attributes.formatters);  
    obj.listElements = "<div id='MojoListItemsParentMarker'></div>";
    this.contentDiv.innerHTML = Mojo.View.render({object: obj, template: this.listTemplate});
    
    // Find the list items parent, insert the items, and then mark them with their index into the data object array:
    placeholder = this.contentDiv.querySelector('#MojoListItemsParentMarker');
    What I'm seeing is that 'placeholder' is null for some reason even though we just added it to the DOM. Strange thing though, it only happens in my app and not in the UIWidgets app.
    bourds: Where are you defining contentDiv? Is that further up in the code?
  7.    #7  
    I'm not sure why this is, but the list widget doesn't seem to work if you don't have the right document type. I changed the begining of my index.html file to:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    And my list widget seems to work now.
  8. #8  
    Yup, the change in document type worked... Thanks!
  9. #9  
    Quote Originally Posted by bourds View Post
    Yup, the change in document type worked... Thanks!
    How in the world did you figure that one out?
  10. #10  
    Thanks for the solution. It had been driving me crazy
  11.    #11  
    I was just accepted into the Early Access Program, and struggled with this problem before I was accepted. They had this fix on the forum there.

    I imagine it is stuff like this which is the reason the SDK isn't public now.
  12. #12  
    This did not seem to fix the problem for me, I have pasted my index.html for you to see.

    Is there something else that I can do to alleviate this error? I have censored the url because to post links I have to post 10 posts first.


    Code:
    <?xml version="1.0" encoding="UTF-8"?> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "*******w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="*******w3.org/1999/xhtml" xml:lang="en" lang="en">
        <head> 
    	<title>News</title> 
    	<script src="/usr/palm/frameworks/mojo/mojo.jsjsjs&$quot$; $type$=&$quot$;$text$/$javascript$&$quot$; $x$-$mojo$-$version$=&$quot$;$1$&$quot$;&$gt$;&$lt$;/$script$&$gt$; 
    	&$lt$;$script$ $src$=&$quot$;$app$/$assistants$/$stage$-$assistant$.$js$&$quot$; $type$=&$quot$;$text$/$javascript$&$quot$;&$gt$;&$lt$;/$script$&$gt$;
    
            &$lt$;!-- $application$ $stylesheet$ $should$ $come$ $in$ $after$ $the$ $one$ $loaded$ $by$ $the$ $framework$ --&$gt$; 
            &$lt$;$link$ $href$=&$quot$;$stylesheets$/$news$.$css$&$quot$; $media$=&$quot$;$screen$&$quot$; $rel$=&$quot$;$stylesheet$&$quot$; $type$=&$quot$;$text$/$css$&$quot$; /&$gt$; 
        &$lt$;/$head$&$gt$; 
        &$lt$;$body$&$gt$; 
        
        &$lt$;/$body$&$gt$; 
    
    &$lt$;/$html$&$gt$;
  13. #13  
    I found this on another forum, thought I would share as I also had the same annoyance...

    Solution: For some reason, the code provided by the SDK does not include a required dash before the property names inside the container and item templates.

    To fix this, instead of using:

    #{listTitle}

    use this instead:

    #{-listTitle}
    Last edited by ksustud6969; 07/23/2009 at 11:04 PM. Reason: g
  14. #14  
    Solution: For some reason, the code provided by the SDK does not include a required dash before the property names inside the container and item templates.

    To fix this, instead of using:

    #{listTitle}

    use this instead:

    #{-listTitle}[/QUOTE]

    Ahh... that fixed it for me! I'm following the Rough Cuts Palm Webos book,
    and tricky to find all of the items in the code that need to be changed
    before the app will work. It seems as though much of it was written before
    the SDK was in its current state.
  15. #15  
    Or put "escapeHTMLInTemplates" : false

    in your framework_config.json
  16. #16  
    The issue I found is in the call to setupWidget I miss spelled the paths for the templates itemTemplate & listTemplate so that it was trying to use an unreachable file/node for the templates.

Posting Permissions