2012-08-27 19 views
0

我有一個單一的HTML頁面,其中我使用兩個是data-role =「page」,另一個是data-role =「dialog」。 在我的頁面的div我有一個按鈕,該按鈕的點擊我想叫格dialog.here是我的榜樣---無法調用數據角色=「對話框」

<html> 
<body> 
<div data-role="page" 
    data-add-back-btn="true" data-theme="d"> 

      <div data-role="fieldcontain" align="vertical"> 
     <input type="reset" data-role="button" value="ok" 
          id="okButton"> 

       </div> 
    $("#okButton").click(function() 
    { 
         $.mobile.changePage("#myDialog"); 
    }); 
    </div> 

<div id="myDialog" data-role="dialog" data-theme="b" > 



    <div data-role="content"> 

     <div data-role="controlgroup" data-type="vertical"> 
     <input type="submit" data-role="button" value="Add Margin" id="addmargin"> 
     <input type="submit" data-role="button" value="CTD" id="ctd"> 
     <input type="submit" data-role="button" value="Square Off" id="squareoff"> 
     <input type="submit" data-role="button" value="Change Sqr.Off Mode" id="changeSqrMode"> 
       </div> 

    </div> 

上面的代碼工作正常,但如果我要打電話點擊表格中的對話框就不會調用它。這裏是我的錶行點擊:

<script type="text/javascript"> 

     $("#tableId tr td").live("click",function(e) 
     {  
       var newrow = $(this).parent().parent().children().index($(this).parent()); 


       e.stopImmediatePropagation(); 
       alert("after e.stopImmediatePropagation"); 

       alert("Before myDialog");    
       $.mobile.changePage('#myDialog'); 


     }); 


    </script> 

這裏myDialog警報顯示,但$ .mobile.changePage( '#myDialog')之前;未執行,或myDialog不顯示。

任何建議將不勝感激。提前致謝。

+0

嗨你的jQM版本..? –

+0

@ArjunTRaj它的1.1.1 – PPD

回答

0

嘗試$.mobile.changePage($('#myDialog'))

+0

使用changePages它給我錯誤:TypeError:表達式的結果'toPage.data(「page」)'[undefined]不是一個對象。在文件:///android_asset/www/jquery.mobile-1.1.1/jquery.mobile-1.1.1.js:2843 – PPD

+0

錯誤提示jQM無法找到您的對話框與選擇器。你可以發佈你想要運行的整個文件,或者是[jsFiddle](http://jsfiddle.net/)? – Alejo

相關問題