jQuery UI Widgets Forums TreeGrid Cannot get TreeGrid to refresh

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 6 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Cannot get TreeGrid to refresh #100555

    George S
    Participant

    Hello, Current version of JQWidgets. I have a Chart… it shows columns… click on a bar, and the details making up the column are shown in a TreeGrid. I could have swore this was working in an older release, but with the new release it is not working… I click on a column for the first time, and the data is shown correctly. I click on a different column, the tree grid clears, but then displays the same data…

    The Treegrid is based on an array that I am loading via JSON. I have verified that the array is changing data. The variable treeCreated is false the first time through, and true each time afterward. This is what I am using to determine if I need to recreate the tree or refresh the tree. (is there a better way?)

            /// NOW DRAW THE TREE
            // prepare the data
            var source2 = {            
                  localdata: myTree,
                  datatype: "array",
                  cache: false,
                  hierarchy: {
                    groupingDataFields: [{
                        name: "cloud_offering"
                    }]
                }
            };
    		
            // create and bind the data adapter.
            var dataAdapter2 = new $.jqx.dataAdapter(source2);
            dataAdapter2.dataBind();
            
            // If we have not created the treegrid, then create it, else refresh it...
            if (treeCreated == false) 
             {
              treeCreated = true;
            // create Tree Grid
            $("#idTreeGrid").jqxTreeGrid({
                width: '100%',
                //width: graphWidth,
                theme: 'light',
                source: dataAdapter2,
                //pageable: true,
                columnsResize: true,
                altRows: true,
                showAggregates: false,
                showSubAggregates: true,
                aggregatesHeight: 100,
                icons: function(rowKey, rowData) {
                    var level = rowData.level;
                    if (level == 0) {
                        // each group row has a label member that contains the information displayed on the group row.   
                        return "#WORKSPACE_IMAGES#images/small_checkmark.png";
                    }
                    return false;
                },              
                ready: function() {
                    $("#idTreeGrid").jqxTreeGrid('expandRow', "0");
                },
                columns: [{
                        text: 'Product Name',
                        dataField: 'product_name',
                        width: 350
                    },
                    {
                        text: 'Product Detail',
                        dataField: 'product_detail'  
                    },
                          
                    {
                        text: 'Order #',
                        dataField: 'sales_order_number',
                        width: 100
                    },
                          
                    {
                        text: 'Used Amount',
                        dataField: 'used_amount_raw',
                        cellsFormat: "c2",
                        width: 150,
                        align: 'right', cellsAlign: 'right',
                        aggregates: ['sum', 'max', 'count']
                    }
                ]
            });
    
             }
            else
              {
                  console.log('refresh called');
                   $("#idTreeGrid").jqxTreeGrid('clear');  
                  
                  //  var dataAdapter2 = new $.jqx.dataAdapter(source2);              
                  //  $("#idTreeGrid").jqxGrid({ source: dataAdapter2 });
                  // $("#idTreeGrid").jqxGrid('refresh');                       
             
                 
                  $("#idTreeGrid").jqxTreeGrid('updateBoundData');  
              }; 
    Cannot get TreeGrid to refresh #100564

    Hristo
    Participant

    Hello George S,

    Could you clarify it? Is there any error message in the console?
    I tested this example and it seems to work fine.
    Please, take a look at this example, too.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.