如果屏幕高度小于Dialog高度,Dialog的top会是负数,可以写一类继承dijit.Dialog 然后把fix写在里面
dojo.provide("company.Dialog");
dojo.require("dijit.Dialog");
/**
* fix the same issue from the dijit.Dialog
*/
dojo.declare("company.Dialog", [dijit.Dialog],{
/**
* @see dijit.Dialog#postCreate
*/
postCreate: function() {
this.inherited(arguments);
this.connect(this, "_position", "_fixPosition");
},
/**
* fix the position while the dialog size is less than the browser screen
*/
_fixPosition: function() {
var mb = dojo._getMarginSize(this.domNode),
viewport = dojo.window.getBox();
if (viewport.h < mb.h) {
var top = dojo.style(this.domNode, 'top');
if (top < 0) {
dojo.style(this.domNode, {top: '0'});
}
}
}
hierarchical属性默认是true的,也就是能帮助你分析层次关系型的数据,但是由于json的灵活性,保不齐哪天后台返回的数据中的某个属性是object时,在没有定义好的id和label时,用到dojo.data.ItemFileReadStore的所有数据型widget都会出错
该类是一个非常值得投入时间的类,他能把关系型数据库做起来比较麻烦的事情丢给前台做,当然调试起来风险也蛮高
partial的强大不仅仅是预定义第0-n个入参的值,还可以分阶段预定义,如果用oo来说 就是一个多态(?)
原例子地址:http://dojotoolkit.org/reference-guide/dojo/partial.html
监听按钮click事件的时候分别使用handler1和handler2有2种截然不同的结果
这个核心函数用js重写也是非常赞的一个尝试
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="ltr">
<head>
<style type="text/css">
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js"
djConfig="parseOnLoad: true">
</script>
<script type="text/javascript">
dojo.require("dijit.form.Button");
dojo.addOnLoad(function() {
var myClick = function(firstValue, secondValue, event) {
var node = dojo.byId("appendLocation");
node.appendChild(document.createTextNode(firstValue));
node.appendChild(document.createElement("br"));
node.appendChild(document.createTextNode(secondValue));
node.appendChild(document.createElement('br'));
}
var handler1 = dojo.partial(myClick, 'This is first text');
var handler2 = dojo.partial(handler1, 'This is second text');
dojo.connect(dijit.byId("myButton"), "onClick", handler2);
});
</script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css"
/>
</head>
<body class=" claro ">
<button dojoType="dijit.form.Button" id="myButton">
Click me to append in a preset value!
</button>
<div id="appendLocation">
</div>
<!-- NOTE: the following script tag is not intended for usage in real
world!! it is part of the CodeGlass and you should just remove it when
you use the code -->
<script type="text/javascript">
dojo.addOnLoad(function() {
if (document.pub) {
document.pub();
}
});
</script>
</body>
</html>
摘要: 在开始使用CSS3前,你应该了解它是什么,为什么要用和如何使用
阅读全文
摘要: PHP jQuery cookbook 前言翻译
阅读全文
摘要: 知识,它们真的只是进入到我的头脑而已,它们不曾碰触到我的心。
阅读全文