jQWidgets Forums

jQuery UI Widgets Forums Grid Grid use with tree

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Grid use with tree #46952

    heimax
    Participant

    Hi,

    I am using grid with a tree column. By using the cellrenderer function

    var treecolumn = function(row, columnfield, value, defaulthtml, columnproperties){
            	console.log(row);
            	console.log(columnfield);
            	console.log(value);
            	   	
            	var treeitem = value || [] ;
            	   	
                   	if (treeitem.length == 0){
                	   	return '<div style="margin-top: 4px; margin-left:3px">No associated item</div>';	
                   	}else{ 
                   		var detailById = [];
                        var item = new Object();
    
                        //check null          
                        $.each( treeitem, function( key, value ) {                	
        			
        				var item = new Object();
        				item.label = value.label;
        				detailById.push(item);
        						
                        });          
                       
                        var source = [
                                      {
                                          label: "Associated item",expanded:true,  items: detailById
                                      }
                                      ]
                       	console.log(source);
                        
                        console.log($("<div />").jqxTree({ source: source, width: '100%', height: 60}).html());
                        
                        // Create jqxTree
                   		
                   		return $("<div />").jqxTree({ source: source, width: '100%', height: 60}).html();
                	}
                   
               }

    The tree column can be added to the grid, but it cannot expand. Is it require to add the expander or any setting I miss ?

    Best Regards,
    heimax

    Grid use with tree #46965

    Peter Stoev
    Keymaster

    Hi heimax,

    Tree Column cannot be displayed within the Grid. It is not designed for such purpose. In addition, you cannot initialize a widget within the “cellsrenderer” callback. That function is designed to return only static HTML.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Grid use with tree #46985

    heimax
    Participant

    Hi Peter,

    Thanks for the answer,

    Any suggestion or advice for create the tree column in the grid?

    Or can I use initeditor to initialize the tree widget?

    Please help.

    Best Regards,

    heimax

    Grid use with tree #46991

    Peter Stoev
    Keymaster

    Hi heimax,

    The only suggestion I can give you is to use jqxTreeGrid.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.