SmartGWT 之 TreeGrid 缩进与ie8

以前用 SmartGWT 的 TreeGrid 没有一点问题。这次新建了一个项目之后,

其中有个地方使用了 TreeGrid, 显示的时候,用别的浏览器没问题,但是用

ie8的话,子节点就不缩进了。在SmartGWT的论坛上搜了一下,有不少人

碰到了问题,但是提出的解决方案是 

 

<meta http-equiv="X-UA-Compatible" content="IE=7">

 

也就是退回到 ie7兼容模式。我使用ie7兼容模式,确实可以正常显示,但是

总感觉很奇怪。今天偶尔看

 

http://www.smartclient.com/releases/SmartGWT_Quick_Start_Guide.pdf

 

这个文档,在它Tips的最后,发现这样一条:

 

Develop and deploy in browser compatibility mode, not 

“standards” mode.

Smart GWT components automatically detect and adapt to the browser 

mode (as determined by DOCTYPE), providing consistent layout and 

rendering behaviors in both standards/strict and compatibility/quirks 

modes. However, the interpretation of ―standards mode‖ varies across 

browsers, and changes across different versions of the same browser. If 

you develop in “standards mode,” the behavior of your application may 

change as users perform regular updates to their OS or browser. In 

many common browsers, ―Standards mode‖ is not, as the name implies, a 

consistent standards-compliant mode.

 

建议不要用标准模式,而用Quirks 模式。于是又找了半天这两种模式的区别,有兴趣的同学

可以去看 http://hsivonen.iki.fi/doctype/

 

我是直接查看了以前没问题的应用,其中doctype是怎么写的。发现新版本的eclipse gwt plugin,

自动生成的 html 里面 doctype是这样的:

 

<!doctype html>

 

而以前是的doctype是:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

 

直接把以前的doctype替换原来的doctype,就一切ok了。

 

细想了一下,其实替换doctype的方法,和smartgwt论坛上提出的增加meta信息,

目的都是一样的,就是不使用标准模式,而是把它变成Quirks模式。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
treegrid插件 当前选中的行: var config = { id: "tg1", width: "800", renderTo: "div1", headerAlign: "left", headerHeight: "30", dataAlign: "left", indentation: "20", folderOpenIcon: "images/folderOpen.gif", folderCloseIcon: "images/folderClose.gif", defaultLeafIcon: "images/defaultLeaf.gif", hoverRowBackground: "false", folderColumnIndex: "1", itemClick: "itemClickEvent", columns:[ {headerText: "", headerAlign: "center", dataAlign: "center", width: "20", handler: "customCheckBox"}, {headerText: "名称", dataField: "name", headerAlign: "center", handler: "customOrgName"}, {headerText: "拼音码", dataField: "code", headerAlign: "center", dataAlign: "center", width: "100"}, {headerText: "负责人", dataField: "assignee", headerAlign: "center", dataAlign: "center", width: "100"}, {headerText: "查看", headerAlign: "center", dataAlign: "center", width: "50", handler: "customLook"} ], data:[ {name: "城区分公司", code: "CQ", assignee: "", children:[ {name: "城区卡品分销中心"}, {name: "先锋服务厅", children:[ {name: "chlid1"}, {name: "chlid2"}, {name: "chlid3", children: [ {name: "chlid3-1"}, {name: "chlid3-2"}, {name: "chlid3-3"}, {name: "chlid3-4"} ]} ]}, {name: "半环服务厅"} ]}, {name: "清新分公司", code: "QX", assignee: "", children:[]}, {name: "英德分公司", code: "YD", assignee: "", children:[]}, {name: "佛冈分公司", code: "FG", assignee: "", children:[]} ] }; /* 单击数据行后触发该事件 id:行的id index:行的索引。 data:json格式的行数据对象。 */ function itemClickEvent(id, index, data){ window.location.href="ads"; } /* 通过指定的方法来自定义栏数据 */ function customCheckBox(row, col){ return ""; } function customOrgName(row, col){ var name = row[col.dataField] || ""; return name; } function customLook(row, col){ return "查看"; } //创建一个组件对象 var treeGrid = new TreeGrid(config); treeGrid.show(); /* 展开、关闭所有节点。 isOpen=Y表示展开,isOpen=N表示关闭 */ function expandAll(isOpen){ treeGrid.expandAll(isOpen); } /* 取得当前选中的行,方法返回TreeGridItem对象 */ function selectedItem(){ var treeGridItem = treeGrid.getSelectedItem(); if(treeGridItem!=null){ //获取数据行属性值 //alert(treeGridItem.id + ", " + treeGridItem.index + ", " + treeGridItem.data.name); //获取父数据行 var parent = treeGridItem.getParent(); if(parent!=null){ //jQuery("#currentRow").val(parent.data.name); } //获取子数据行集 var children = treeGridItem.getChildren(); if(children!=null && children.length>0){ jQuery("#currentRow").val(children[0].data.name); } } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值