Jsgrid: http://js-grid.com/docs/#onitemupdated incorrect object name

Created on 9 Sep 2015  路  2Comments  路  Source: tabalinas/jsgrid

sir:
i noticed that object name in

onItemUpdated
{
...
previuosItem
}
onItemUpdating
{
...
previuosItem
}

correct object name is "previousItem".

another issue is
when i try to update one row data but failed , then i clicked "search" button not "x" button , wrong data will still keep on it.
my config

{
            inserting: true,
            filtering: true,
            editing: true,
            sorting: true,
            autoload: true,
            paging: true,
            pageSize: 10,
            pageButtonCount: 5
.....
}

thanks for your help

bug

Most helpful comment

Thank you for the report.
Docs is fixes.
I've managed to reproduce the updateItem issue.

For now you can do the following:
Always resolve the result of updateItem, but in case of fail just resolve it with lastPrevItem. You can save the lastPrevItem on onItemUpdating callback from args.previousItem.

updateItem: function(updatingClient) {
    var result = $.Deferred();

    // your ajax call instead of rejected
    var ajaxDeferred = $.Deferred().reject();

    ajaxDeferred.done(function(updatedItem) {
        result.resolve(updatedItem);
    }).fail(function() {
        result.resolve(lastPrevItem);
    });

    return result.promise();
}

See the working fiddle: http://jsfiddle.net/tabalinas/2LLha4r7/

All 2 comments

Thank you for the report.
Docs is fixes.
I've managed to reproduce the updateItem issue.

For now you can do the following:
Always resolve the result of updateItem, but in case of fail just resolve it with lastPrevItem. You can save the lastPrevItem on onItemUpdating callback from args.previousItem.

updateItem: function(updatingClient) {
    var result = $.Deferred();

    // your ajax call instead of rejected
    var ajaxDeferred = $.Deferred().reject();

    ajaxDeferred.done(function(updatedItem) {
        result.resolve(updatedItem);
    }).fail(function() {
        result.resolve(lastPrevItem);
    });

    return result.promise();
}

See the working fiddle: http://jsfiddle.net/tabalinas/2LLha4r7/

wow! thank you sir.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Julian-B90 picture Julian-B90  路  4Comments

venkatesh333 picture venkatesh333  路  4Comments

danielson317 picture danielson317  路  3Comments

fredericoregateiro picture fredericoregateiro  路  3Comments

julmarci picture julmarci  路  4Comments