We have a ignite ui grid bound to a knockout model . But the grid does not update when an item is deleted from the knockout model using the observablearray.shift() or observablearray.pop() method
However the grid does get updated when we try to add an item using the push method. Has anyone of us tried this with any success ??
The versions are as follows
IE8
Knockout JS : v3.0.0
Ignite UI : 13.2.20132.2157
Regards,
Nilav
Hello Nilav,
Both shift and pop should work correctly. Have you defined a primary key for your grid? Have you observed any exceptions in the browser's console?
Best regards,
Stamen Stoychev
Hi Staymen,
I have tried the same multiple times and have failed. Also i do not see any exceptions in the browser console. We also have a primary key defined on the grid. Could you please share a sample solution which i can use to test that is working on your end.
Please let me know Stamen's example gave you the information you need or if you need any additional assistance.
Thanks!
Hi guys,
I rigorously tested this example and my use case. Yes this example works perfectly under normal circumstances. However when we try to 'pop' or 'shift' an object from the knockout model inside the success/error callback in an ajax call, the grid fails to update,
Do please test out that scenario as well and lemme kno your thoughts. I am placing a sample case below.
$.ajax({ url: '/api/MaintenanceService/PopStaticData',
contentType: 'application/json; charset=utf-8',
type: 'POST',
data: JSON.stringify(args.values),
success: function (item) {
model.data.pop(); //this does not work
}
Nilav Ghosh
Just a passing thought. Could it be because the success function in called on a non UI thread in javascript and we would need to verify whether the knockout binding functions fire correctly irrespective on which thread the data is modified.