View Full Version : Weird behavior of multiselect GridPanel with restful Data.Store

25 Mar 2011, 10:48 AM
I am trying to implement a multiselect gridpanel with a restful data store such that I can do things like multiselect delete.

Basically, if I multiselect two items then click the delete button the following code is run:

function onDelete() {
var records = pnGridPanel.getSelectionModel().getSelections();
if (!records) {
return false;

After .remove is called two restful DELETEs are sent to the server each with the id of one of the rows. That's good. The contents of the GridPanel disappear. That's also good. Then the script exits the onDelete function and that when things get weird.

After exiting the function the gridpanel re-displays the two records that were just remove and a third record which is a duplicate of one of the original two.

If I change things to use singleSelect, that is remove sm: new Ext.grid.RowSelectionModel({singleSelect:false}) from my grid panel and change my onDelete function to call pnGridPanel.getSelectionModel().getSelected() then the row disappears when I exit the onDelete function then reappears after the Button.onClick() exits.



25 Mar 2011, 4:54 PM
After adding

Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res, arg) {
alert("Something bad happend while executing " + action);

I was able to make some headway. Eventually, after spending a lot of time unraveling the ball of yarn that is the code path for making this request/response cycle it turns out the JsonReader code was not able to properly read the successProperty in the response. Apparently it's not good enough for the server to send the string "true" it needs to send a boolean value.

26 Mar 2011, 7:12 AM
Well spotted