×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    12

    Dynamic ui.dialog content?

    I'm sorry for repeating this question, but since the previous one in an existing thread went unanswered, I decided to ask it inside a thread of its own.

    Is there a way to make a ui.dialog innerHTML content dynamic and how please (could you give an example)?

    I've tried using the example code from the previous thread and setting the innerHTML from the onClick function of the dialog showing button:
    Code:
                            onClick: function () {
                                     this.parent.dialog.label.innerHTML = dynamicTextVar;				
    				  this.parent.dialog.visible = true;
    				   this.parent.dialog.label.visible = true;
    				    this.parent.dialog.childbutton.visible = true;
    				  this.parent.map.visible = false;
    			}
    but that didn't work at all, I've also tried setting it inside the innerHTML layout description of the this.parent.dialog.label but that also couldn't work and returned undefined for me, and I've seen some text and binding description properties in other examples but couldn't figure out how data binding works...so could you please write or point towards a simple example?

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2012
    Posts
    65

    Re: Dynamic ui.dialog content?

    Hi ntek,


    here is an example. I hope it helps.
    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <title>Dialog</title>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=100">
        <meta name="HandheldFriendly" content="True">
        <meta name="MobileOptimized" content="width">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
        <meta name="touch-event-mode" value="native">
        <meta name="cursor-event-mode" value="native">
    
        <link rel="stylesheet" href="http://api.maps.nokia.com/mobile/1.0.2/lib/mh5.css" type="text/css">
        <link rel="stylesheet" href="http://api.maps.nokia.com/mobile/1.0.2/lib/colors.css" type="text/css">
        <style type="text/css">
            html {
                font-size: 10px;
            }
            html, body {
                position: relative;
                height: 100%;
                width: 100%;
                margin: 0;
                padding: 0;
                border: 0;
            }
        </style>
    </head>
    <body class="mh5_hwacc_body">
        <script type="text/javascript" src="http://api.maps.nokia.com/mobile/1.0.2/lib/mh5.js"></script>
        <script type="text/javascript">
            window.onload = function() {
                setTimeout(function() {
                    var myDialogClass = new nokia.mh5.Class(nokia.mh5.ui.Dialog, function (parent) {
                        return {
                            cssClass: "myClass",
                            content: {
                                control: nokia.mh5.ui.Container,
                                children: ["message", "okButton"],
                                message: {
                                    control: nokia.mh5.ui.Control,
                                    innerHTML: "Click Ok"
                                },
                                okButton: {
                                    control: nokia.mh5.ui.Button,
                                    text: "Ok",
                                    onClick: function() {
                                         this.parent.message.root.innerHTML = "Ok was clicked";
                                    }
                                }
                            }
                        }
                    });
    
                    var myDialog = new myDialogClass();
    
                    document.body.appendChild(myDialog.root);
                }, 1000);
            }
        </script>
    </body>
    </html>

Similar Threads

  1. How to scroll in a dynamic content (DIV)?
    By vanlopes in forum Nokia Asha Web Apps
    Replies: 1
    Last Post: 2012-09-18, 12:25
  2. Qt Quick SelectionDialog with dynamic content from C++
    By oskari.petas in forum [Archived] Qt Quick
    Replies: 14
    Last Post: 2012-02-06, 10:32
  3. Guarana components with dynamic content
    By ivanlitovski in forum Symbian
    Replies: 2
    Last Post: 2010-01-22, 13:30
  4. Dynamic content of CAknSettingItemList
    By vzblk in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-05-17, 14:02
  5. How to dynamic create dialog use..
    By xingpingz in forum Symbian User Interface
    Replies: 1
    Last Post: 2007-05-16, 13:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×