"Node cannot be inserted at the specified point in the hierarchy"

I am doing javascript like forests. And, the code below shows the table. It works fine for all of them, not just one table that I get - when centering processing on the third row - I get a "Node cannot be inserted at the specified point in the hierarchy" exception.

   function table_one_view(table) {
        $.getJSON('<%= Url.Action("TableOneView", "Scaffold") %>', { table: table },
                function(out) {
                    var tl = tpl('.table-one-view');
                    ctr().empty().append(tl);

                    $.each(out.columns, function(i, n) {
                        tl.find('thead > tr').append(
                            tpl('.table-one-view-header').html(n.name)
                        );
                    });

                    for (var y = 0; y < out.rows.length; y++) {
                        var tl_row = tpl('.table-one-view-row');

                        for (var x = 0; x < out.rows[y].length; x++) {
                            //error is here
                            tl_row.append(tpl('.table-one-view-cell').html(out.rows[y][x] ? out.rows[y][x] : "&nbsp;"));
                        }

                        tl.find('tbody').append(tl_row);
                    }
                }
          );
    }

    function tpl(query) {
      var t = $('.template ' + query).clone(true).removeClass('in');
      t.find('.in').remove();
      return t; 
    }
    function ctr() { return $('.container.scaffold'); }

      

Rather, I could give you a link so you can check and see the runtime error.

0


source to share


1 answer


I fixed this by using



out.rows[y][x].toString()

      

+1


source







All Articles