DHTMLX 前端框架 建立你的一个应用程序教程(二)--设置布局
生活随笔
收集整理的這篇文章主要介紹了
DHTMLX 前端框架 建立你的一个应用程序教程(二)--设置布局
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
Layout控件的演示
?
Dhtmlx有很多的組建來組織網頁的建設, 這篇主要介紹dhtmlxLayout?。 下面圖片中 布局將各個組件(1.Menu 2.Toolbar 3.Grid 4.Form 表單)劃分到不同的區域。
?
設置布局:
?
1.初始化一個布局用dhtmlXLayoutObject()?
在index.html添加如下代碼:
<!DOCTYPE html> <html><head><title>Contact Manager</title><script src="codebase/dhtmlx.js" type="text/javascript"></script><link rel="stylesheet" type="text/css" href="codebase/dhtmlx.css"></head><body><script type="text/javascript">dhtmlxEvent(window,"load",function(){
var layout = new dhtmlXLayoutObject(document.body,"2U");
});
</script></body> </html>
上面這個布局的構造函數有兩個參數 ?一個是html的布局容器 ?一個是布局的參數 2u
下面來看看布局的默認幾種參數:
?
2.給頁面添加以下樣式 ?確保布局的全屏模式
<style>html, body {width: 100%; /*provides the correct work of a full-screen layout*/ height: 100%; /*provides the correct work of a full-screen layout*/overflow: hidden; /*hides the default body's space*/margin: 0px; /*hides the body's scrolls*/} </style>
3. 用setText()?方法來設置布局單元格的標題 在index js中添加
dhtmlxEvent(window,"load",function(){var layout = new dhtmlXLayoutObject(document.body,"2U");layout.cells("a").setText("Contacts");layout.cells("b").setText("Contact Details");
}); dhtmlXLayout API包含了兩方面 一個是dhtmlXLayout對象的API 另一個是dhtmlXLayout 單元格的API
4.用setWidth() 方法來設置布局單元格的寬度
dhtmlxEvent(window,"load",function(){var layout = new dhtmlXLayoutObject(document.body,"2U");layout.cells("a").setText("Contacts");layout.cells("b").setText("Contact Details");layout.cells("b").setWidth(500);
});
然后查看我們的效果:
?
轉載于:https://www.cnblogs.com/DemoLee/p/4032217.html
總結
以上是生活随笔為你收集整理的DHTMLX 前端框架 建立你的一个应用程序教程(二)--设置布局的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScipt面向对象编程----闭
- 下一篇: macos port总结