zoukankan      html  css  js  c++  java
  • easyui学习笔记5—panel加载其他的页面

    上一篇中我们看到了panel的基本实现,没有什么难度,最重要的是data-options和class两个标签属性的定义。这里我们将看一下在panel中如何加载其他的页面。

    1.先看看引用的资源文件和html

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8"/>
            <title>Load Panel Content - jQuery EasyUI Demo</title>
            <link rel="stylesheet" href="jquery-easyui-1.3.5/themes/default/easyui.css" />
            <link rel="stylesheet" href="jquery-easyui-1.3.5/themes/icon.css" />
            <link rel="stylesheet" href="jquery-easyui-1.3.5/demo/demo.css" />
            <script type="text/javascript" src="jquery-easyui-1.3.5/jquery.min.js"></script>
            <script type="text/javascript" src="jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
        </head>
        <body>
            <h2></h2>
            <div class="demo-info">
                <div class="demo-tip icon-tip"></div>
                <div>Click the refresh button on top right of panel to load content.</div>
            </div>
            <div style="margin:10px 0;"></div>
            <div id="p" class="easyui-panel" title="Load Panel Content" style="500px;height:200px;padding:10px;" data-options="
                tools:[{iconCls:'icon-reload',handler:function(){$('#p').panel('refresh','_content.html')}}]
            ">
                
            </div>
        </body>
    </html>

    这里没有什么要说的了还是两个主要的js文件jquery.min.jsjquery.easyui.min.js最主要的选项是data-options=" tools:[{iconCls:'icon-reload',handler:function(){$('#p').panel('refresh','_content.html')}}] "指定了这个panel的标签样式和加载的页面,执行的动作是refresh。

    2.再看看这个加载的html文件,其实就是一一段简单的文字,如下

    <!DOCTYPE html>
    <html>
    <head>
            <meta charset="UTF-8">
            <title>AJAX Content</title>
    </head>
    <body>
            <p style="font-size:14px">Here is the content loaded via AJAX.</p>
            <ul>
                    <li>easyui is a collection of user-interface plugin based on jQuery.</li>
                    <li>easyui provides essential functionality for building modem, interactive, javascript applications.</li>
                    <li>using easyui you don't need to write many javascript code, you usually defines user-interface by writing some HTML markup.</li>
                    <li>complete framework for HTML5 web page.</li>
                    <li>easyui save your time and scales while developing your products.</li>
                    <li>easyui is very easy but powerful.</li>
            </ul>
    </body>
    </html>

     3.注意在jquery里面所有的关键字都是区分大小写的,这个和javascript是一致的

                            $('#centerContent').panel({
                                href:"_publish.html?Id="+selectedRow.Id,
                                onLoad:function(){
                                    //alert("aa");
                                    $('#comBusiness').combobox('setValue', selectedRow.Business);
                                    if(selectedRow.Business!=null){
                                        $('#comBusiness').combobox('setValue', selectedRow.Business);
                                    }
                                    if(selectedRow.Solution!=null){
                                        $('#comSolution').combobox('setValue', selectedRow.Solution);
                                    }
                                    if(selectedRow.Service!=null){
                                        $('#comService').combobox('setValue', selectedRow.Service);
                                    }
                                    if(selectedRow.About!=null){
                                        $('#comAbout').combobox('setValue', selectedRow.About);
                                    }                                
                                }
                            });

    在这一段中,我错误的把onLoad写成了onload,然后悲剧了折磨了我两个小时,写成小写的是不管用的,切记,切记!

  • 相关阅读:
    关于安卓9patch图片的探究
    android中系统时间
    android中的对话框
    swing界面刷新问题
    android中的xml解析全解
    android中listView下拉刷新
    次小生成树(poj 1679)
    poj 2312(bfs+priority_queue)
    poj 2060(最小路径覆盖)
    poj 1734 (最小环)
  • 原文地址:https://www.cnblogs.com/tylerdonet/p/3521760.html
Copyright © 2011-2022 走看看