0

I'm getting a problem with my Tree Grid, I can just expand the first level, its children come with a icon that does not allow to expand anymore, what am i doing wrong? View

Grid Load Complete, I thing the error is here...

loadComplete: function () {
    $(this).find("tr.jqgrow").each(function (tr) {
        var idLinha = $(this).attr('id');
        var level = this.cells[4].childNodes[0].data;
        $(this).find("div.treeclick").bind("click", function (e) {
            var classes = $(this).attr('class');
            if (classes.indexOf('-minus') != -1) {
                if (!$(this).hasClass('expanded')) {
                    $(this).addClass('expanded');
                    $.ajax({
                        type: 'post',
                        url: '@Url.Action("AddFilhos")',
                        data: { p_PaiID: idLinha, p_Level: level },
                        dataType: "json",
                        success: function (result) {
                            for(var c_Area = 0; c_Area < result.rows.length; c_Area++)
                            {
$('#listaRelatorioFormulario').addChildNode(result.rows[c_Area].id, result.rows[c_Area].parent, result.rows[c_Area]);
                            }
                        }
                    });
                }
            }
            else if (classes.indexOf('-plus') != -1) {
            }
        });
    });
},

1 Answers1

0

To expand the nodes during loading of the TreeGrid you need just include expanded: true. See the answer for example for more information.

Be careful about another bug described in the answer (the workaround is described in the answer too).

UPDATED: You should read additionally the answer which could be probably also interesting for you.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798