Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

ListGrid removeSelectedData calling Delete method multiple times

$
0
0
Hi

We are trying to remove a record from the ListGrid using the
Code:

listGrid.removeSelectedData();
and also used another way
Code:

                ListGridRecord userRecord = listGrid.getSelectedRecord();
               
                ListGridRecord[] userRecords = listGrid.getSelectedRecords();
               
                for (ListGridRecord listGridRecord : userRecords) {

                    Map<String, String> params = new HashMap<String, String>();
                    params.put("_wsId", (String) SessionCtxt.getInstance().getCurrentWsId());
                    params.put("_removeWsRecord", "true");
                    params.put("_sessionId", SessionCtxt.getInstance().getId());
                    params.put("_id", userRecord.getAttribute("_id"));
                    DSRequest requestProperties = new DSRequest();
                    requestProperties.setData(params);
                   
                    listGrid.removeSelectedData(new DSCallback() {
                               
                                @Override
                                public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) {
//                                        if (dsResponse.getStatus() == RPCResponse.STATUS_SUCCESS) {
                                                fetchData();
//                                        }
                                       
                                }
                        }, requestProperties);                       
                }

The way we do it is we call a REST API to delete the record when removeSelectedData is called
If we select only one record then the record gets deleted fine and the listGrid also updates correctly.
But when we select 2 records it calls the REST API twice and if we select 3 records it calls the REST Call 3 times and so on.
and in all the cases the first call is correct and sends SUCCESS back but as number of calls are done after that it throws errors

We want to restrict the call of removeSelectedData just once
Sending you all the required parameters with this

Version: 4.0-p20130904
Browser: All browser IE, Chrome and firefox

Viewing all articles
Browse latest Browse all 4756

Trending Articles