This is a migrated thread and some comments may be shown as answers.

[Solved] Problem with Rebind

0 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 04 Jan 2012, 02:29 PM
This working

success: function (data) {
                    var grid = $("#Grid").data('tGrid');
                    var newdata = grid.data;                    
                    newdata.push(data);                    
                    grid.dataBind(newdata);
}

This not working

success: function (data) {               
                var grid = $("#Grid").data("tGrid");
                var newdata = grid.data;
                for (var i = newdata.length - 1; i >= 0; i--) {
                                    if (newdata[i].Id ==
data.Id) {
                                        newdata.splice(i, 1);
                                    }
                                }
                grid.dataBind(newdata);
}


or
success: function (data) {               
                var grid = $("#Grid").data("tGrid");
                var newdata = grid.data;
                var newdata = jQuery.grep(newdata, function (value) {
                    return value.Id != data.Id;
                });
                grid.dataBind(newdata);
}

When I remove item of array the Rebind not working. The grid does not refresh.
Any idea?
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Share this question
or