dojo dgrid tree, subrows in wrong position

Posted by Ventura on Stack Overflow See other posts from Stack Overflow or by Ventura
Published on 2012-11-20T12:24:26Z Indexed on 2012/11/20 23:02 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
|

I have a dgrid, working with tree column plugin. Every time that the user click on the tree, I call the server, catch the subrows(json) and bind it. But when it happens, these subrows are show in wrong position, like the image bellow. The most strange is when I change the pagination, after go back to first page, the subrows stay on the correct place.

(please, tell me if is possible to understand my english, then I can try to improve the text)

dgrid with wrong position subrows

My dgrid code:

  var CustomGrid = declare([OnDemandGrid, Keyboard, Selection, Pagination]);

    var grid = new CustomGrid({
        columns: [
            selector({label: "#", disabled: function(object){ return object.type == 'DOCx'; }}, "radio"),
            {label:'Id', field:'id', sortable: false},
            tree({label: "Title", field:"title", sortable: true, indentWidth:20, allowDuplicates:true}),
            //{label:'Title', field:'title', sortable: false},
            {label:'Count', field:'count', sortable: false}
        ],
        store: this.memoryStore,
        collapseOnRefresh:true,
        pagingLinks: false,
        pagingTextBox: true,
        firstLastArrows: true,
        pageSizeOptions: [10, 15, 25],
        selectionMode: "single", // for Selection; only select a single row at a time
        cellNavigation: false // for Keyboard; allow only row-level keyboard navigation
    }, "grid");

My memory store:

loadMemoryStore: function(items){

            this.memoryStore = Observable(new Memory({
                data: items,
                getChildren: function(parent, options){
                    return this.query({parent: parent.id}, options);
                },
                mayHaveChildren: function(parent){
                    return (parent.count != 0) && (parent.type != 'DOC');
                }

            }));

        },

This moment I am binding the subrows:

        success: function(data){

            for(var i=0; i<data.report.length; i++){
                this.memoryStore.put({id:data.report[i].id, title:data.report[i].created, type:'DOC', parent:this.designId});
            }

        },

I was thinking, maybe every moment that I bind the subrows, I could do like a refresh on the grid, maybe works. I think that the pagination does the same thing.

Thanks.

edit:

I forgot the question. Well, How can I correct this bug? If The refresh in dgrid works. How can I do it? Other thing that I was thinking, maybe my getChildren is wrong, but I could not identify it.

thanks again.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dojo