Hi,
I am using a Radgrid with script services for the data binding.
For deleting a row, I implemented a GridClientDeleteColumn which fires a "Delete"-command on which I am deleting the clicked row via a script service. After deleting a row, the rowIndexes are actually not updated and I get some errors when I am deleting several rows after each other.
Here is my code:
There problem occurs because the commandArgument() isnot beeing updated after deleting the row and even not after I call the databind method again. Deleting itemIndex 0 will cause that the following first item has itemIndex 1 but it must be zero for fetching the right datatime.
I am using a Radgrid with script services for the data binding.
For deleting a row, I implemented a GridClientDeleteColumn which fires a "Delete"-command on which I am deleting the clicked row via a script service. After deleting a row, the rowIndexes are actually not updated and I get some errors when I am deleting several rows after each other.
Here is my code:
function KontakthistorieGridCreated(ansprechpartnerid) {
pms_neu.grid_service.get_history(window.location.hostname, ansprechpartnerid, kontakthistorieUpdateGrid);
}
function kontakthistorieUpdateGrid(result) {
var tableView = $find("<%= rdg_historie.ClientID %>").get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
tableView.set_virtualItemCount(result.length);
adjust_pane_heights();
}
function OnCommand(sender, args) {
//Die funktion kann ruhig leer sein, MUSS aber vorhanden sein (irgendwas mit Client-Object erstellen und so...)
if (args.get_commandName() == "Delete") {
var itemIndex = args.get_commandArgument();
var history_id = sender.get_masterTableView().get_dataItems()[itemIndex].getDataKeyValue("id");
pms_neu.grid_service.delete_history(window.location.hostname, history_id, history_delete_done);
args.set_cancel(true);
}
}
There problem occurs because the commandArgument() isnot beeing updated after deleting the row and even not after I call the databind method again. Deleting itemIndex 0 will cause that the following first item has itemIndex 1 but it must be zero for fetching the right datatime.
var itemIndex = args.get_commandArgument();
var history_id = sender.get_masterTableView().get_dataItems()[itemIndex].getDataKeyValue("id");
Does anyone knows a solution for this?
I would really appreciate some help on this
Kind regards