0

我的带有列表视图的 Jquery 移动表单具有以下格式。

<div data-role="page" id="arealistpage">

  <div data-role="header" data-theme="b">
        <h1>Area</h1>
        <a href="../MenuePages/Dictionaries.aspx" class='ui-btn-left ui-btn-back' data-icon='arrow-l' rel="external">Back</a>   <!-- your button to go back to index.php#user page -->
   <a href="AddArea.aspx" data-role="button" data-icon="plus" data-theme="d" style="float:left;"  rel="external" data-transition="slide">Add</a>
    </div><!-- /header -->

    <div data-role="content">  
    <ul data-role="listview" data-inset="true" data-theme="c"  data-filter="true" id="areaList" data-split-icon="gear" data-split-theme="d">
  <li><a href="#dialog?AreaNo=1" data-rel="dialog" data-transition="pop">Test</a><a class="deleteMe"></a></li>
    </ul>

    </div><!-- /content -->

     <div data-role="footer" data-theme="b" data-position="fixed">

            <div data-role="navbar">
            <ul>

               <li><a href="" data-role="tab" data-icon="arrow-u" class="returnTopAction">Top</a></li>
            </ul>
        </div>
    </div>


        <!-- /content -->

</div><!-- /page -->
<div data-role="page" id="dialog">
  <div data-role="header" data-theme="b">
    <h1>Options</h1>
  </div>   

 <ul data-role="listview" data-inset="false"
                data-theme="c">
               <%-- <li data-role="divider" data-theme="a">Options</li>--%>
                <li data-icon="false"><a>Edit</a></li>
                <li data-icon="false"><a>Delete</a></li>
                <li data-icon="false"><a>...</a></li>
            </ul>   
</div> 

我需要打开“对话框” div 作为列表视图行单击的对话框并从对话框中读取 url 参数。我需要从 url 获取 AreaNo 参数

  • 标记并将其传递给打开对话框中的编辑 URL。目前我无法打开对话框并且它不工作。请帮助和抱歉英语不好

  • 4

    1 回答 1

    1

    我改变了你的 html 如下

    <div data-role="page" id="arealistpage">
        <div data-role="header" data-theme="b">
             <h1>Area</h1>
     <a href="../MenuePages/Dictionaries.aspx" class='ui-btn-left ui-btn-back'
            data-icon='arrow-l' rel="external">Back</a> 
            <!-- your button to go back
            to index.php#user page --> <a href="AddArea.aspx" data-role="button" data-icon="plus" data-theme="d"
            style="float:left;" rel="external" data-transition="slide">Add</a>
    
        </div>
        <!-- /header -->
        <div data-role="content">
            <div id="primaryList">
                <ul data-role="listview" data-inset="true" data-theme="c" data-filter="true"
                id="areaList" data-split-icon="gear" data-split-theme="d" id='dialogListView'>
                    <li><a href="#dialog" data-rel="dialog" data-transition="pop" data-areano="1">Test</a>
    
                        <a
                        class="deleteMe"></a>
                    </li>
                </ul>
            </div>
        </div>
        <!-- /content -->
        <div data-role="footer" data-theme="b" data-position="fixed">
            <div data-role="navbar">
                <ul>
                    <li><a href="" data-role="tab" data-icon="arrow-u" class="returnTopAction">Top</a>
    
                    </li>
                </ul>
            </div>
        </div>
        <!-- /content -->
    </div>
    <!-- Dialog Page -->
    <div data-role="page" id="dialog">
        <div data-role="header" data-theme="b">
             <h1>Options</h1>
    
        </div>
        <div data-role="content">
            <ul data-role="listview" data-inset="false" data-theme="c">
                <!-- <li data-role="divider" data-theme="a">Options</li>-->
                <li data-icon="false"><a>Edit</a>
    
                </li>
                <li data-icon="false"><a>Delete</a>
    
                </li>
                <li data-icon="false"><a>...</a>
    
                </li>
            </ul>
        </div>
    </div>
    

    并为列表添加了一个点击事件,如下所示

    $('div[id="primaryList"] ul[data-role="listview"] a').live("click", function () {
        var areaNo = $(this).data("areano");
        sessionStorage.areaNo = areaNo;
        alert("area no : " + sessionStorage.areaNo);
    });
    

    现在您可以使用会话存储变量访问整个应用程序中的区号sessionStorage.areaNo。在此处阅读有关sessionStorage 的更多信息。

    这是一个工作小提琴http://jsfiddle.net/9CctZ/7/

    于 2013-03-05T06:03:30.780 回答