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

Grid API method trigger help

11 Answers 361 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 09 Feb 2012, 09:12 PM
We have a grid on the browser page that works great BUT we want it to save every time they delete a record, and then to notify them the record was saved of course. (displaying the same page of data).

Issue:
We cannot seem to get the grid to refresh. We see the API function but our interpretation of the docs is not working for us.

11 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 09 Feb 2012, 09:20 PM
I enter this in the console of the browser dev tool. - - - m = jQuery('#grid').data('kendoGrid') 
m.saveChanges()
- - -

Then I get this result.

- - - 

undefined

- - -

the grid is a fully functional grid with a toolbar and a "Save changes" button that is working.
0
Nikolay Rusev
Telerik team
answered on 14 Feb 2012, 10:20 AM
Hello John,

You can set autoSync: true in DataSource configuration in order to achieve this behavior as demonstrated on the jsFiddle bellow:
http://jsfiddle.net/rusev/Rhz72/

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mike
Top achievements
Rank 1
answered on 27 Feb 2012, 07:43 PM
Ok well... autosync doesn't work for the delete button that appears in the grid, at least not with my version of kendo (open source version).  I have a grid and the delete button removes the row but doesn't call the destroy transport.  I debugged it and when the datasource creates the ModelSet it doesn't set the autosync flag of the ModelSet.  So when the modelset is created it's defaulted to autosync = false.  When you go to delete the row is removed but ModelSet checks for "autosync" and skips the sync because it's always false.
0
Nikolay Rusev
Telerik team
answered on 29 Feb 2012, 02:59 PM
Hello Mike,

autoSync: true seems to be working on the jsFiddle attached to my previous post.

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mike
Top achievements
Rank 1
answered on 29 Feb 2012, 08:35 PM
HI Nikolay,

Yes it MIGHT seem like your autosync is working but I would be suspect at least for delete buttons.   I know the create and updates commands work even if I do not specify a setting for autosync,  But I could not get delete buttons to work on remote datasources. When I click delete on the grid button, the grid removes the item but the items come back if I refresh.  Just like your fiddle and all of the KendoUi.com demos, deletes are not persisted.  Of course I expect this to happen in your demos or they wouldn't work very well if everyone could delete the demo data.  

I have set  autosync to true on my datasource and editable is set to true on my grid.  Clicking delete removes the item off my grid... but the destroy url is never called.  When I debugged it I noticed that the datasource has set autosync=true but the underling object called modelset still has the default set of autosync = false. so the modelset does not call sync after it removes the item.    So when I refresh the items come back.  I have put a break point in my server delete controller so I know it's not getting called.  Again I have the open source version of kendo so maybe it's fixed in a new version I don't have.  The only way I could get this to work was to make my own button using a kendo template, getting the item id off the grid and calling remove and sync on the datasource manually.

thanks
0
Nikolay Rusev
Telerik team
answered on 05 Mar 2012, 10:39 AM
Hello Mike,

Please check the video posted bellow:
http://screencast.com/t/sfQP72exlPKD

autoSync seems to be working properly. The jsFiddle is the last I've posted in this thread.

All the best,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Randy
Top achievements
Rank 1
answered on 29 Mar 2012, 02:22 AM
How did you get it to work manually?

I added a custom command button and was successfully able to delete the object using dataSource.remove(dataItem). This fires the destroy event on the server and removes the item from the grid. The next time i refresh the item is still there even though it has been removed from the database.

Is there some caching going on here that is causing this behavior. If i put a breakpoint in the read methods it doesnt hit on every refresh.
0
Nikolay Rusev
Telerik team
answered on 02 Apr 2012, 08:58 AM
Hello Randy,

There is a jsfiddle with working example in this thread. The video is captured against this example. There is no caching involved in the example. I guess for your scenario you should verify whether on sync deleted items are actually deleted from the data storage.

You can also check the following repositories with fully working Grid CRUD operations:
https://github.com/telerik/kendo-examples-asp-net-mvc
https://github.com/telerik/kendo-examples-asp-net

Greetings,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sergey
Top achievements
Rank 1
answered on 15 May 2012, 05:22 AM
Solution:
replace new version Kendo UI to old (from example where is it work):
<script type='text/javascript' src="http://cdn.kendostatic.com/2011.3.1407/js/kendo.all.min.js"></script>

To support: Find this problem in the new version Kendo UI.
0
Johsua
Top achievements
Rank 1
answered on 15 May 2012, 11:07 AM
Hi nikolay,
waiting for your comment on sergey's post.
0
Mike
Top achievements
Rank 1
answered on 15 May 2012, 02:50 PM
This was clearly broken in kendo.all in earlier versions.   I have the code so I can post it if you like.    However you guys fixed it in later versions exactly like I described in my earlier post.    The autosync flag is now being pasted to the modelset class. The first version I've used where the bug is fixed is  v2011.3.1407.  I'm not sure when it was fixed but v2011.3.1407  has the fix that makes autosync work.  

However with the latest versions of kendo (v2012.1.503)...  all of the relative code has been reworked and I have not tested it.   I'm assuming it's still fixed. The bug I'm talking about is... delete command on a grid not calling sync even when autosync is set to true.   So if your having delete problems make sure your kendo.all version is at least v2011.3.1407 or greater.

 
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Mike
Top achievements
Rank 1
Randy
Top achievements
Rank 1
Sergey
Top achievements
Rank 1
Johsua
Top achievements
Rank 1
Share this question
or