how to work w/o datasource

5 posts, 0 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 13 Jan 2012 Link to this post

    I have tried several methods to get data in the grid (and may be other controls where datasource can be used).

    But my overall experience has been that datasource should not be the only option available to show/refres data in the grid and other controls. We should be able to do that via regular functions. For example, if I am able to receive data using any javascript function in the format of Array [object, object, object] then I expect to be able to

    > initialize the grid with this data if the grid is not displayed
    > refresh the grid with this content if grid has some old data
    > insert this data in the grid or append it somewhere in the grid

    But I notice most of the examples are with 'datasource' and its either very hard to configure the datasource or I am not savvy enough to do this. 

    so if we can work with the kendo objects without using datasource configuration of url/type etc that would be useful. I would like functions such as init(Array) refresh(Array) or something like that if possible.

    -Piyush
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Jan 2012 Link to this post

    Hi,

    We generally don't intend to introduce API which will work without the DataSource. The latter is a very important part of Kendo UI and all data access and data operations are performed through it. Inserting records is supported via the insert/add/ methods of the datasource. You can use the data() method to replace all data.

    grid.dataSource.data([object, object])

    Regards,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Naveen
    Naveen avatar
    9 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    HI all,
    iam getting below error,can any one help me to solve this error.iam getting this eoor while connecting data from database through odata services.

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code/>
    <message xml:lang="en-IN">
    The query parameter '$format' begins with a system-reserved '$' character but is not recognized.
    </message>
    </error>

  5. Amol
    Amol avatar
    5 posts
    Member since:
    Jan 2012

    Posted 24 Jan 2012 Link to this post

    What about an empty datasource? How to generate one?
  6. Gary
    Gary avatar
    14 posts
    Member since:
    Jan 2012

    Posted 25 Jan 2012 Link to this post

    If you want to use DataSource.{add, insert} you need to define a schema model on that DataSource. Unfortunately, those methods throw exceptions if you haven't defined a model. If you want to use local Javascript objects, you need to initialize the DataSource data attribute with a new Array or they'll all use the same one (from the initialization options), and then simply manipulate the data Array:

    DataSource ds = new kendo.data.DataSource({
      data: []
    });

    var data = ds.data();
    data.push({id: 42});
    ds.read(data);
Back to Top
Kendo UI is VS 2017 Ready