-
16 Mar 2011 9:52 AM #1
Query Odata Feed
Query Odata Feed
Hi,
is it possible to query a odata feed using Ext.data.Store ?
I keep getting an parse error.
Anyone knows how to do it ?
thanks
-
16 Mar 2011 11:08 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
More than likely. What does the feed look like? Got a URL?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
16 Mar 2011 5:22 PM #3
Thanks for your fast reply.
For now its an internal odata feed.
But its prety much like this one :
http://services.odata.org/Northwind/Northwind.svc/
http://services.odata.org/Northwind/Northwind.svc/Customers?$format=json
if you can show me for example how to load the Customers (json format) to a data store to use it on a list would be awsome !
Thanks in advance!
-
21 Mar 2011 9:24 AM #4
Query
Query
For querying you don't need much, the problem arises when you want to write to the store but, if it is just for reading you just need to configure store like this:
var store = new Ext.data.JsonStore({
root: 'd',
url: 'http://services.odata.org/Northwind/Northwind.svc/Customers?$format=json',
fields:[...],
...
});
This works as expected, i'm using it, i'm also working on an "OdataStore" (and corresponding OdataProxy) to support writing but is not finnished yet.
I hope that helps a bit to clarify things.
-
9 Apr 2011 1:41 PM #5
We did some work on querying an OData store back with ExtJS 3.0 and ADO.NET Data Services 1.5. I hope to update this to work with ExtJS 4.0 and WCF Data Services at some point, but haven't had a chance to work on this yet. One of my co-workers posted some information on the approach we took previously, which may be of value.
http://blogs.ignia.com/Levi.Fleischm...ices.rest.aspx
Jeremy
-
10 Jun 2011 2:19 PM #6
Odata
Odata
I plan on implementing this in the next month or so.
If anyone else is working on this, please let me know. I would rather not reinvent the wheel but it will be good practice for me if anything.
Any suggestions would be greatly appreciated. I think the trick will be updating I believe.
If i'm successful, i'll post the link here.
-
12 Jun 2011 7:46 AM #7
I'm also interestead into it for Ext 4.0.2 - any progress so far?
-
12 Sep 2011 8:44 AM #8
Bump!
Im also interested in this topic, anything happend this year yet?
-
8 Nov 2011 10:22 AM #9
I need to build front-end applications for WCF Data Services web services using the OData protocol.
Is there any progress on a compatible store for this with CRUD support?
-
12 Nov 2011 5:56 AM #10
Please see this very basic implementation of OData Protocol which WCF Data Services use.
This Proxy support CRUD operations and sorting.
PHP Code:/*
Open Data Protocol Implementation for Ext Js 4
Links:
ExtJs 4 Server Proxy: http://docs.sencha.com/ext-js/4-0/source/Server.html#Ext-data-proxy-Server
ExtJs 4 Ajax Proxy: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.proxy.Ajax
OData URI Conventions: http://www.odata.org/developers/protocols/uri-conventions
License: GNU General Public License v3 http://www.gnu.org/copyleft/gpl.html
Author: Oleg Dolzhansky dolzhansky@gmail.com
Example:
Ext.define('Customer', {
extend: 'Ext.data.Model',
fields: [
{name: 'id', type: 'int', defaultValue: 0},
{name: 'name', type: 'string'}
],
idProperty: 'id'
});
var CustomersStore = Ext.create('Ext.data.Store', {
model: 'Customer',
proxy: {
type: 'odata',
url : '/Service.svc/Customers'
},
autoLoad: true
});
*/
Ext.define('Ext.ux.data.proxy.OData', {
extend: 'Ext.data.proxy.Ajax',
alternateClassName: 'Ext.ux.data.ProxyOData',
alias: 'proxy.odata',
/* Builds URL in the form Entity(Id), for example http://localhost/Service.svc/Customers(5) */
buildUrl: function (request) {
var me = this,
operation = request.operation,
records = operation.records || [],
record = records[0],
url = me.getUrl(request),
id = record ? record.getId() : operation.id;
if (id) {
if (url.match(/\/$/)) {
url = url.substring(0, url.length - 1);
}
url = url + '(' + id + ')';
}
request.url = url;
return me.callParent(arguments);
},
/* Returns a string of comma-separated fields from sortes with optional 'desc' directive */
encodeSorters: function (sorters) {
var min = [],
length = sorters.length,
i = 0;
for (; i < length; i++) {
min[i] = sorters[i].property;
if (sorters[i].direction.toLowerCase() == 'desc') {
min[i] += ' desc';
}
}
return min.join(',');
}
}, function () {
Ext.apply(this.prototype, {
actionMethods: {
create: 'POST',
read: 'GET',
update: 'PUT',
destroy: 'DELETE'
},
reader: {
type: 'json',
root: 'd'
},
headers: {
'Accept': 'application/json'
},
pageParam: undefined,
startParam: '$skip',
limitParam: '$top',
sortParam: '$orderby',
noCache: false
});
});
Last edited by Oleg Dolzhansky; 15 Nov 2011 at 6:46 PM. Reason: Corrected namespace
Similar Threads
-
Reading a OData feed into Ext-JS
By pkaur in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 21 Mar 2011, 9:26 AM -
OData
By mcamer in forum Sencha Touch 1.x: DiscussionReplies: 5Last Post: 21 Mar 2011, 9:26 AM -
Refresh feed list(feed Panel) in feedviewer examples
By adelphus in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 6 Nov 2008, 10:33 PM -
Updating Title text Of a Feed on Feed panel
By adelphus in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 17 Jul 2008, 11:40 PM


Reply With Quote