標籤:framework library dhtmlx dhx
官網連結:http://dhtmlx.com/docs/products/dhtmlxTouch/說明
dhtmlx功能十分強大,作為免費且開源的基於html5的javascript library,dhx的功能十分強大。[It‘s not just a set of UI widgets, but a complete framework that allows you to create eye-catching, robust web applications that run on iOS, Android, and other mobile platforms.]
dhtml的基本文法dhx.ui({..\\ 定義一個view,放置任意組件})
$$(‘row_logs‘) 聲明id? 引用id來找到對應的控制項
事件
onDocumentReady dhx.Ready(function(){…})The alternative to ‘onDocumentReady‘ event is dhx.Ready(function(){…}) function. So, to ensure that your code will be executed as soon as the page finishes loading, put all your code inside this function. 類似onLoad
type:"MainBar"
type:"round"
header:true
{
id:"grid", view:"grid", header:true,
fields:[{ id:"Name",
label:"Name",
...
},
{ id:"email",//specifies the second column of the grid
label:"email",
}]
理解View與element的關係:每一個view有點像android中的framelayout
$(document).ready(function(){} jquery 當頁面載入完成以後
Dhx.ready 當documen已經載入完
Layout
toolbar.push({"width":div_width_gap});
{ template:"top" },
template:"<div style=‘float:left‘><div class=‘title‘>#title#</div> <div class=‘author‘>by #author#</div></div>"
1設定邊界以分隔組件
控制1“Type用於指定塊與塊之間的間隔。layout blocks (‘cols‘ or ‘rows‘)
dhx.ui({ type:"space",// specifies a type of the border rows:[{ ... }]})
‘line‘(default) 所有視圖間無間隔,但有一條線
‘wide‘,與父視圖間無間隔,子視圖間有間隔
‘head‘ 類似wide
‘clean‘ 沒有任何間隔
‘space‘ 所有視圖間等間隔
或 type:{ height:35 }
DHTMLX Touch allows to set border, padding and margin of a component.
控制2:padding margin
Padding是內邊距,是站在自己的角度 就是內容與邊框的距離;margin是外邊距,是站在容器的角度 就是邊框與其他元素的距離。
動態設定大小和調整調用Resize(),該元素的所有子子項目與父容器都會重新確定大小。
{
view:"toolbar", type:"SubBar",
elements:[{ view:"button", inputWidth:200, value:"Resize", click:resize}]
},
function resize(){
$$(‘list1‘).define("height", 300);
$$(‘list1‘).define("width", 500);
$$(‘list1‘).resize();
};
調整該元素的大小為其父元素的大小,但是子項目大小不改變
function adjust(){
document.getElementById(‘divB‘).style.height="200px";
list2.adjust();
}
若是想修改同一父容器內的多個子項目的大小,可以通過父容器的resize(true)方法。實現方式:重繪所有的子項目。
$$(‘list1‘).define("width", 300);
$$(‘list2‘).define("width", 100);
...
$$(‘layout_id‘).resize(true);
..
點餐系統執行個體該執行個體是本人在demo的基礎上修改完成,和原來的應用區別不是很大:
下面是本人的另一個應用的其中一個介面的:
歡迎有興趣的朋友一起交流!!!
講一講dhtmlx