Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何删除backgridjs行以显示新行?_Javascript_Backbone.js_Backgrid - Fatal编程技术网

Javascript 如何删除backgridjs行以显示新行?

Javascript 如何删除backgridjs行以显示新行?,javascript,backbone.js,backgrid,Javascript,Backbone.js,Backgrid,这将向原始网格追加一组新行: var refreshgrid = function(){ var grid = new Backgrid.Grid({ columns: columns, collection: ter }); // Render the grid and attach the root to your HTML document // $("#example-1-result").append(grid.remove())

这将向原始网格追加一组新行:

var refreshgrid = function(){
    var grid = new Backgrid.Grid({
      columns: columns,
      collection: ter
    });

    // Render the grid and attach the root to your HTML document
   // $("#example-1-result").append(grid.remove());
    $("#example-1-result").prepend(grid.render().$el);
}
因此,每次我调用它时,它都会附加到网格中,而不是覆盖它,这就是我想要的。 如何实现它?

使用
.html()

var refreshgrid = function(){
    var grid = new Backgrid.Grid({
      columns: columns,
      collection: ter
    });

    // Render the grid and attach the root to your HTML document
    $("#example-1-result").html(grid.render().$el);
}