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

[Solved] Grid Settings vs. DataSource Settings

2 Answers 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bilal
Top achievements
Rank 2
Bilal asked on 30 Oct 2014, 03:03 PM
Hi,
I am newly learning Kendo UI. I realized that the DataSource plays the role of reading, creating, updating, and deleting of data. So far, I noticed that it's being used only with Grid to do so. For instance, if I have an HTML form, can I still use DataSource to carry on CRUD operations? For example, when user submits a form, can I ask DataSource to create new record, or update existing, or delete existing by calling functions on DS?

Some of the settings set on DataSource like paging, sortable, grouping, etc. Also, Grid has similar such settings. Is it necessary to add those settings on both Grid and DataSource? I am kind of mixed up here.

Thank you & regards
Bilal 

2 Answers, 1 is accepted

Sort by
0
Bilal
Top achievements
Rank 2
answered on 30 Oct 2014, 03:08 PM
I wanted to edit my post, but didn't find how, so I had to reply to it.

Even going through the documentation, in one case, the code it setting a custom editor for the Grid column specifying it's required, also it sets the required on DataSource. Why have both?

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.editor

Thanks
0
Accepted
Petur Subev
Telerik team
answered on 03 Nov 2014, 11:57 AM
Hello Bilal,

You can use the dataSource separately from the Grid however keep in mind that the DataSource is responsible for managing a collection of items, not just a single item. Here is a demo that uses DataSource:

http://demos.telerik.com/kendo-ui/datasource/local-operations

The settings of the DataSource specify at what level the different operations such as sorting, filtering etc are performed - they could be on the server (implemented by the developer manually) or on the client (built into the framework

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-serverSorting

While on the other hand the Grid has settings which specify whether the sorting is enabled on the Grid at all. For example you can have two Grids wired to one dataSource (or other widgets) and one of the Grids allows sorting and the other one does not.

As explained in the highlighted text the developer is responsible to add the corresponding required attribute since he customizes the input and takes full control how the editor is rendered.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Bilal
Top achievements
Rank 2
Answers by
Bilal
Top achievements
Rank 2
Petur Subev
Telerik team
Share this question
or