How can i identify whether my grid data is edited or not on client side

5 posts, 0 answers
  1. Fajleabbas
    Fajleabbas avatar
    2 posts
    Member since:
    Mar 2014

    Posted 13 Mar 2014 Link to this post

    Hi,

    i am using batch editing grid,is there any solution for checking weather my data is edited or not  in grid using javascript 
  2. Dimo
    Admin
    Dimo avatar
    8475 posts

    Posted 20 Mar 2014 Link to this post

    Hi Fajleabbas,

    You can detect when the Grid enters and exits edit mode via the widget events (cancel, edit, save):

    http://docs.telerik.com/kendo-ui/api/web/grid

    With the help of these events, you can raise some flags (assign Javascript variables), which will allow you to detect the Grid state at any given time.

    Probably the easiest option is to check whether the Grid contains edit cells:

    var isEdited = $("#GridID").find(".k-edit-cell").length > 0;


    Regards,
    Dimo
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  3. Fajleabbas
    Fajleabbas avatar
    2 posts
    Member since:
    Mar 2014

    Posted 21 Mar 2014 in reply to Dimo Link to this post

    Hi Dimo,

    Thank u for replying.

    but using $("#GridID").find(".k-edit-cell").length i am not getting my edited cell count
     
    insert of finding .k-edit-cell class i just find .k-dirty-cell then it get actual number of edited cell count.

    Regards,
    Fajleabbas
  4. aspforyou
    aspforyou avatar
    2 posts
    Member since:
    Apr 2014

    Posted 21 Apr 2014 in reply to Dimo Link to this post

    Your response was not as helpful as a stackoverflow post on jqgrid. Are you technical? 
  5. Dimo
    Admin
    Dimo avatar
    8475 posts

    Posted 22 Apr 2014 Link to this post

    Hello,

    Looking at the thread content so far, it seems that there has been misunderstanding about what "whether my data is edited" means (i.e. "is in edit mode" or "has been modified"), but obviously Fajleabbas has managed to find a solution that works for him. Another possible way is to use the hasChanges() method of the Grid dataSource. It will return a boolean value that indicates whether there are modified data items that have not been synced (saved) yet.

    http://docs.telerik.com/kendo-ui/api/framework/datasource#methods-hasChanges

    http://docs.telerik.com/kendo-ui/api/web/grid#fields-dataSource

    $("#GridID").data("kendoGrid").dataSource.hasChanges()


    Regards,
    Dimo
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top