jQuery EasyUI从入门到精通(10)

2025-11-14 01:01:16

1、Nested Layout(嵌套布局),The layout region panel contains another layout or other components(这种布局区域面板包含另一个布局或者其它组件).

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Nested Layout - jQuery EasyUI Demo</title>

    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">

    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">

    <link rel="stylesheet" type="text/css" href="../demo.css">

    <script type="text/javascript" src="../../jquery.min.js"></script>

    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>

</head>

<body>

    <h2>Nested Layout</h2>

    The layout region panel contains another layout or other components.

    <div style="margin:20px 0;"></div>

    <岔言div class="easyui-layout" style="width:700px;height:350px;">

        <div data-options="region:'north'" style="height:50px"></div>

        <div data-options="region:'south',split:true" style="height:50px;"></div>

        <div data-options="region:'east',split:true" title="East" style="width:180px;"></div>

        <div data-options="region:'west',split:true" title="West"鬼沟 style="width:100px;"></div>

        <div data-options="region:'center',iconCls:'icon-ok'" title="Center">

            <div class="easyui-layout" data-options="fit:true">

                <div data-options="region:'north',split:true,border:false" style="height:50px"></div>

                <div data-options="region:'west',split:true,border:false" style="width:100px"></div>

                <div data-options="region:'center',border:false"></div>

            </div>

        </div>

    </div>

</body>

</html>

jQuery EasyUI从入门到精通(10)

2、Nested Layout(嵌物择肺套布局),运行效果如下图所示。

jQuery EasyUI从入门到精通(10)

3、No collapsible button in Layout(没有折叠按钮的布局),The layout region panel has no collapsible button.

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>No collapsible button in Layout - jQuery EasyUI Demo</title>

    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">

    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">

    <link rel="stylesheet" type="text/css" href="../demo.css">

    <script type="text/javascript" src="../../jquery.min.js"></script>

    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>

</head>

<body>

    <h2>No collapsible button in Layout</h2>

    The layout region panel has no collapsible button.

    <div style="margin:20px 0;"></div>

    <div class="easyui-layout" style="width:700px;height:350px;">

        <div data-options="region:'north'" style="height:50px"></div>

        <div data-options="region:'south',split:true" style="height:50px;"></div>

        <div data-options="region:'east',split:true,title:'East',collapsible:false" style="width:250px;">

            <table id="tt" class="easyui-propertygrid" data-options="

                        url: 'propertygrid_data1.json',

                        method: 'get',

                        showGroup: true,

                        fit: true,

                        border: false

                    ">

            </table>

        </div>

        <div data-options="region:'center',title:'Main Title',iconCls:'icon-ok',href:'_content.html'" style="padding:10px">

        </div>

    </div>

</body>

</html>

jQuery EasyUI从入门到精通(10)

4、No collapsible button in Layout(没有折叠按钮的布局),运行效果如下图所示。

jQuery EasyUI从入门到精通(10)

5、Auto Height for Layout(自适应高度布局),This example shows how to auto adjust layout height after dynamically adding items.

<!DOCTYPE html>

<html>

<head>

   <meta charset="UTF-8">

   <title>Auto Height for Layout - jQuery EasyUI Demo</title>

   <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">

   <link rel="stylesheet" type="text/css" href="../../themes/icon.css">

   <link rel="stylesheet" type="text/css" href="../demo.css">

   <script type="text/javascript" src="../../jquery.min.js"></script>

   <script type="text/javascript" src="../../jquery.easyui.min.js"></script>

</head>

<body>

   <h2>Auto Height for Layout</h2>

   This example shows how to auto adjust layout height after dynamically adding items.

   <div style="margin:20px 0;">

       <a href="javascript:void(0)" class="easyui-linkbutton" onclick="addItem()">Add Item</a>

       <a href="javascript:void(0)" class="easyui-linkbutton" onclick="removeItem()">Remove Item</a>

   </div>

   <div id="cc" style="width:700px;height:350px;">

       <div data-options="region:'north'" style="height:50px"></div>

       <div data-options="region:'south'" style="height:50px;"></div>

       <div data-options="region:'west'" style="width:150px;"></div>

       <div data-options="region:'center'" style="padding:20px">

           Panel Content.

           Panel Content.

           Panel Content.

           Panel Content.

           Panel Content.

       </div>

   </div>

   <script type="text/javascript">

       $(function(){

           $('#cc').layout();

           setHeight();

       });

       

       function addItem(){

           $('#cc').layout('panel','center').append('More Panel Content.');

           setHeight();

       }

       

       function removeItem(){

           $('#cc').layout('panel','center').find('p:last').remove();

           setHeight();

       }

       

       function setHeight(){

           var c = $('#cc');

           var p = c.layout('panel','center');    // get the center panel

           var oldHeight = p.panel('panel').outerHeight();

           p.panel('resize', {height:'auto'});

           var newHeight = p.panel('panel').outerHeight();

           c.layout('resize',{

               height: (c.height() + newHeight - oldHeight)

           });

       }

   </script>

</body>

</html>

jQuery EasyUI从入门到精通(10)

6、Auto Height for Layout(自适应高度布局),运行效果如下图所示。

jQuery EasyUI从入门到精通(10)

7、Fluid Layout(流式布局),Percentage width of region panel in a layout.

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Fluid Layout - jQuery EasyUI Demo</title>

    <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">

    <link rel="stylesheet" type="text/css" href="../../themes/icon.css">

    <link rel="stylesheet" type="text/css" href="../demo.css">

    <script type="text/javascript" src="../../jquery.min.js"></script>

    <script type="text/javascript" src="../../jquery.easyui.min.js"></script>

</head>

<body>

    <h2>Fluid Layout</h2>

    Percentage width of region panel in a layout.

    <div style="margin:20px 0;"></div>

    <div class="easyui-layout" style="width:700px;height:350px;">

        <div id="p" data-options="region:'west'" title="West" style="width:30%;padding:10px">

            width: 30%

        </div>

        <div data-options="region:'center'" title="Center">

        </div>

    </div>

</body>

</html>

jQuery EasyUI从入门到精通(10)

8、Fluid Layout(流式布局),运行效果如下图所示。

jQuery EasyUI从入门到精通(10)

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢