Thiago C. S Ventura
Thiago C. S Ventura

Reputation: 2592

Dojo dgrid, put icons in each subrow in Plugin Column tree (PDF, HTML, XSL)

I have done a dojo dgrid, where I have a tree field(Plugin Column). I am trying put icons(PDF, HTML and XLS) in each subrow for the user to do download. I tried to use formatter: function(item, rowIndex, cell) for create the icons, but it damages my tree column, simply stops work. I did not find anything like what I want to do on the documentation.

The following image show my example: icons subrows

I tried mix HTML, as well, but did not work, and I would not like to do it this way, mixing HTML with my javascript.

How can I do this?

Upvotes: 0

Views: 1023

Answers (1)

Thiago C. S Ventura
Thiago C. S Ventura

Reputation: 2592

I don't know if it is the best solution, but I solved this way.

I created a new column(plugin column), and across CSS I took out the vertical line between the columns(for simulate a colspan). But you can do colspan through dgrid, but I prefered through CSS(easier).

My plugin column stayed like this:

editor({label: ' ', field: 'idDOC', sortable: false, canEdit: function(obj){

                    if(obj.type == 'DOC'){

                        if(obj.format == 'xls'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconXls';
                        }

                        if(obj.format == 'html'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconHtml';
                        }

                        if(obj.format == 'pdf'){
                            this.editorArgs.iconClass = 'dijitEditorIcon dijitEditorIconPdf';
                        }

                        return true;
                    }

                    return false;

                }, editorArgs:{onClick: function(obj){

                    var node = that.memoryStore.get(that.designId);
                    var format;

                    for(var i=0; i<node.children.length; i++){

                        if(node.children[i].id == this._dgridLastValue){
                            format = node.children[i].format;
                        }

                    }

                    window.location.href = that.domain+'/'+that.designId+'/'+this._dgridLastValue+'/'+format;

                }, label:'View', showLabel:true}}, Button),

Thanks

Upvotes: 2

Related Questions