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

SQL Server Database using oData

0 Answers 242 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Pedro
Top achievements
Rank 2
Pedro asked on 04 Jan 2012, 09:36 PM
Hello,

I don't know where to start...

But I'll start here: 
I was following along on the Kendo UI Video you guys have about the Datasource video.
I managed to get the data from my SQL Server Database Service and populated the data in a Kendo UI Grid.

I have a splitter with a grid in the middle column.

I created the 2 forms on the left and the right columns for the Create and Edit Forms, respectively.

Whenever I enter the fields necessary for my create form, and I click my create button, nothing happens. Nothing shows up on fiddler, nor Chrome. But my field clearing and dataSource.read(); do work.

Here is my jQuery for the DataSource:

var payItems = kendo.data.Model.define({
  id: "PayItemID"
});
 
 
var dataSource = new kendo.data.DataSource({
  type: "odata",
  transport: {
    read: {
      url: URL,
      type: "GET"
    },
    create: {
      url: URL,
      type: "POST"
    },
    update: {
      type: "PUT"
    },
    destroy: {
      type: "DELETE"
    }
  },
  schema: {
    total: "count",
    model: payItems
  }
});  //end of dataSource var

I also have the update and destroy urls dynamically in the grid's change event.

this.dataSource.options.transport.update.url = URL + "(" + id + ")";
this.dataSource.options.transport.destroy.url = URL + "(" + id + ")";

Which doesn't work by the way. Whenever I click on my delete or update button, the url that gets used is the html's url.

Which then I went on to try the manual approach, I put in a specific item that I wanted to update. And when I click on my update button, my grid gets updated but my service does not. When I used fiddler, I noticed that my request header method is using "OPTIONS" instead of "PUT". The same for my delete button, the row on the grid disappears, but the request header method is using "OPTIONS" instead of "DELETE".

I was wondering if you guys could help me solve this, or direct me to a resource that has the functionality I need.

Please and thank you,

P


No answers yet. Maybe you can help?

Tags
Data Source
Asked by
Pedro
Top achievements
Rank 2
Share this question
or