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

Updating Radgrid Row on focus change

1 Answer 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BSL Support
Top achievements
Rank 1
BSL Support asked on 16 Mar 2011, 06:33 PM
Hi,

i have a radgrid in inline edit mode all the time. i currently am doing a batch update when they click on the update command button.
i want to go a step further and save data   "when user enters data in the column and moves onto enter data in a column in the next row"    so in simple terms i want to save row data on row focus change. how can i achieve this functionality.

any suggestions would be appreciated.

Thank you,

Murali.

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 21 Mar 2011, 11:43 AM
Hello,

In order to implement the desired functionality, I recommend that you modify the code from the Client edit with batch server update demo to process the changes on each row click:
function RowClick(sender, eventArgs) {
    if (editedCell) {
        //if the click target is table cell or span and there is an edited cell, update the value in it
        //skip update if clicking a span that happens to be a form decorator element (having a class that starts with "rfd")
        if ((eventArgs.get_domEvent().target.tagName == "TD") ||
            (eventArgs.get_domEvent().target.tagName == "SPAN" && !eventArgs.get_domEvent().target.className.startsWith("rfd"))) {
            UpdateValues(sender);
            ProcessChanges();
            editedCell = false;
        }
    }
}
 
function ProcessChanges() {
    //extract edited rows ids and pass them as argument in the ajaxRequest method of the manager
    if (editedItemsIds.length > 0) {
        var Ids = "";
        for (var i = 0; i < editedItemsIds.length; i++) {
            Ids = Ids + editedItemsIds[i] + ":";
        }
        $find("<%=RadAjaxManager1.ClientID %>").ajaxRequest(Ids);
    }
    else {
        alert("No pending changes to be processed");
    }
    editedItemsIds = [];
}

I hope this helps.

Best wishes,
Mira
the Telerik team
Tags
Grid
Asked by
BSL Support
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or