PDA

View Full Version : Loading Ext Classes required in a User Extension (OData.js)



FSolutionsDev
28 Mar 2014, 3:35 AM
Hi,

in order to connet to our MVC Web Api Controller Services using the OData Protocol, I implemented the User Extension : http://www.sencha.com/forum/showthread.php?194911 which for a GET Request seemed to work (returning valid json Data). I am using SA and have added the OData.js into the Resources folder.
My Rest proxy is thus defined as:
proxy: {
type: 'odata',
withCredentials: false,
username: 'mike',
password: 'pass',
url: 'https://.....',
reader: {
type: 'json'
}
}
The index.html which is auto-generated places the following reference:
<script src="resources/OData.js"></script>

When the OData.js is executed there is an override statement:

Ext.override(Ext.data.proxy.Server,{...,
where Ext.data is in this place undefined. It seems this code is executed before the Ext.Loader starts its work.

So my questions are:
Is this the way to use a custom extension (e.g. embed it in the resouce folder and use it )?
What must I do to avoid this error. How can I assure the required Ext classes are loaded for an external resource ?
"TypeError: Ext.data is undefined,



Ext.override(Ext.data.proxy.Server,{

FSolutionsDev
28 Mar 2014, 8:31 AM
Hi,

may I add to the previous post, that what would really be great is to have an Odata proxy type out of the box in Architect. I have seen in the Sencha Store there is a plugin of Odata for SAP, but that does probably not help for connecting to other OData Rest Services.
I have continued working with the OData extension (described above) as a js Resource and managed to load and save data, so I presume the other CRUD operations will also work. What is nice is that you can set the HTTP Verbs to the operations (create, read, update, delete).

My Problem with the missing reference to Ext.Data is probably a trivial one. I still have not figured out how to load that class. Is it Ext.Create('className', function() {
..here goes the rest of the code that needs className
}

Anyway, SA is a phantastic tool and saved me a lot of time getting started with ExtJs on Real World projects in a way to get well designed structure and code.

Thanks !

honestbleeps
31 Mar 2014, 7:48 AM
First of all, I'm really happy to hear that you're liking Architect so far! Thanks for the kind words!

To work with classes outside of the default supported set, you can load them as a resource the way you are now, or if you need them to be "live" in the canvas, we've added the ability to create Architect User Extensions by packaging them up and defining them a bit for Architect.

I have a blog post about the process here: http://www.sencha.com/blog/building-a-user-extension-and-integrating-it-into-sencha-architect-3-part-2/

(http://www.sencha.com/blog/building-a-user-extension-and-integrating-it-into-sencha-architect-3-part-2/)The reason that Ext.ux.* classes aren't supported right out of the box is that they're not considered "full fledged" members of the framework. The other classes have all been tested / designed to work inside of Architect, but sometimes these Ext.ux.* classes may need a tweak or two. For example, they may expect certain parameters to be passed in immediately upon instantiation, where Architect may not "know" to do that, etc.

I do have an OData AUX for Sencha Touch that I can send you if you like so that you can work from an existing example if you PM me your email address.

FSolutionsDev
31 Mar 2014, 7:55 AM
Hi Steve,

yes, that would be great (sending the odata aux), is there a way to provide you with my mail adress, without posting it to the forum?

I will definetly have a look at your instruction on building user extension.

Thanks a lot

honestbleeps
31 Mar 2014, 7:56 AM
yes you can click on my username and send a private message!