咸鱼的翻身技术

JAVA/JAVASCRIPT

#

Dialog的position的一个fix

如果屏幕高度小于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'});
            }
        }
    }

posted @ 2011-07-28 10:42 hopesfish 阅读(401) | 评论 (0)编辑 收藏

dojo.data.ItemFileReadStore的一个关键属性hierarchical

hierarchical属性默认是true的,也就是能帮助你分析层次关系型的数据,但是由于json的灵活性,保不齐哪天后台返回的数据中的某个属性是object时,在没有定义好的id和label时,用到dojo.data.ItemFileReadStore的所有数据型widget都会出错

该类是一个非常值得投入时间的类,他能把关系型数据库做起来比较麻烦的事情丢给前台做,当然调试起来风险也蛮高

posted @ 2011-07-15 17:57 hopesfish 阅读(589) | 评论 (0)编辑 收藏

dojo.partial的官方例子增强

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>

posted @ 2011-07-14 15:37 hopesfish 阅读(585) | 评论 (0)编辑 收藏

18m的event log

     摘要: 18m的event log...  阅读全文

posted @ 2011-07-12 16:51 hopesfish 阅读(182) | 评论 (0)编辑 收藏

google app engine guide

     摘要: my first private toy  阅读全文

posted @ 2011-06-17 16:10 hopesfish 阅读(184) | 评论 (0)编辑 收藏

2011产品

效果图












设计文档
酒店客房终端重构文档

培训课件
WWW纵观
前端基础上
UI组件发展史

posted @ 2011-05-23 18:30 hopesfish 阅读(143) | 评论 (0)编辑 收藏

Stunning CSS3-Charpter 1

     摘要: 在开始使用CSS3前,你应该了解它是什么,为什么要用和如何使用  阅读全文

posted @ 2011-04-06 18:30 hopesfish 阅读(338) | 评论 (0)编辑 收藏

PHP jQuery Cookbook-前言

     摘要: PHP jQuery cookbook 前言翻译  阅读全文

posted @ 2011-03-28 18:00 hopesfish 阅读(319) | 评论 (0)编辑 收藏

酒店走访系统开发 DAY III

     摘要: 酒店走访系统开发 pauseing..  阅读全文

posted @ 2011-02-22 23:14 hopesfish 阅读(262) | 评论 (0)编辑 收藏

顿悟

     摘要: 知识,它们真的只是进入到我的头脑而已,它们不曾碰触到我的心。  阅读全文

posted @ 2011-01-27 10:44 hopesfish 阅读(378) | 评论 (0)编辑 收藏

仅列出标题
共6页: 1 2 3 4 5 6