【问题标题】:dojo Setting dgrid indentWidthdojo 设置 dgrid indentWidth
【发布时间】:2013-09-09 19:58:07
【问题描述】:

我创建了一个带有选择器和树列的新 dgrid。除了树列中 childNodes 的缩进之外,我可以填充数据并且网格正常工作。我创建了我的树如下:

var treeGrid = new (declare([OnDemandGrid, Selection]))({
            store:this.store,
            id: this.id + ".tree",
            selectionMode: "none",
            loadingMessage: "Loading...",
            noDataMessage : "No results found.",
            showHeader :false,
            columns : [
                       selector({className:"tocCheckboxColumn"}),
                       tree({field:"displayName", sortable:false, indentWidth:20})
                       ]
        },this.domNode);

我的想法是我应该能够将 indentWidth 属性设置为列本身的一部分,但它似乎不起作用,并且我所有的孩子都直接在父级下方呈现而没有任何缩进。有任何想法吗?谢谢!

【问题讨论】:

    标签: javascript tree dgrid


    【解决方案1】:

    所以问题出在我商店的 getChildren 方法上。为了让我的 indentWidth 注册,我在将我的 queryResults 返回到 store.put 之前添加了一个调用,用于在 getChildren() 中对其进行更改后添加的对象。

    var children = [];
    array.forEach(infos, lang.hitch(this, function(info) {
        var child = {                                                
     ...
     };
        children.push(child);
        this.store.add(child);
        }));
        def.resolve(children);
        object.fetchedChildren = true;
        this.store.put(object);
        return new dojo.store.util.QueryResults(def.promise);   
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-19
      相关资源
      最近更新 更多