【问题标题】:Dojo- domAttr.set not working in IEDojo-domAttr.set 在 IE 中不起作用
【发布时间】:2013-07-30 11:22:51
【问题描述】:

我想在dojo 1.8中给div标签设置style属性,我使用了如下代码。

    require([
        "dojo/request",
        "dojo/store/Memory",
        "dgrid/OnDemandGrid",
        "dojo/store/JsonRest",
        "dojo/dom",
        "dojo/dom-attr"
    ], function (request, Memory, OnDemandGrid,JsonRest,dom,domAttr) {
            jsonstore = new JsonRest({target: url,idProperty: "srno"});
            grid = new OnDemandGrid({
                store: jsonstore,
                columns: Layout,
                minRowsPerPage : 40,
                maxRowsPerPage : 40,
                keepScrollPosition : true,
                loadingMessage: "Loading data...",
                noDataMessage: "No results found."
            }, "grid");
            domAttr.set(dom.byId("grid"),"style","height:250px");
            grid.startup();
        });

firefox 可以正常使用。在 IE 中,下面的代码不起作用

        domAttr.set(dom.byId("grid"),"style","height:250px");

我发出警报并验证。

         alert(domAttr.get(dom.byId("grid"),"style")

在 Firefox 中,它显示 height:250px 。在 IE 中为空。 谁能告诉我如何让 domAttr.set 在 IE 中也能正常工作?

【问题讨论】:

    标签: dojo dgrid


    【解决方案1】:

    尝试使用 dojo/dom-style 代替 dom-Attr

    require(["dojo/dom-style"], function(domStyle){
     domStyle.set("someNode", "width", "100px");
    });
    

    这是参考的链接:http://dojotoolkit.org/reference-guide/1.8/dojo/dom-style.html#dojo-dom-style

    问候,米里亚姆

    【讨论】:

    • 很高兴能帮到你
    猜你喜欢
    • 2013-08-01
    • 2017-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-01
    • 1970-01-01
    • 2010-10-30
    • 2011-07-31
    相关资源
    最近更新 更多