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

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

4 Answers 872 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fajleabbas
Top achievements
Rank 1
Fajleabbas asked on 13 Mar 2014, 06:47 AM
Hi,

i am using batch editing grid,is there any solution for checking weather my data is edited or not  in grid using javascript 

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 20 Mar 2014, 03:30 PM
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.

 
0
Fajleabbas
Top achievements
Rank 1
answered on 21 Mar 2014, 07:33 AM
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
0
aspforyou
Top achievements
Rank 2
answered on 21 Apr 2014, 07:16 PM
Your response was not as helpful as a stackoverflow post on jqgrid. Are you technical? 
0
Dimo
Telerik team
answered on 22 Apr 2014, 05:55 AM
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.

 
Tags
Grid
Asked by
Fajleabbas
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Fajleabbas
Top achievements
Rank 1
aspforyou
Top achievements
Rank 2
Share this question
or